Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IndexOutOfRangeException when loading an xlsx with pivot table #651

Closed
1 of 3 tasks
kelleadr opened this issue Jan 12, 2018 · 4 comments · Fixed by #1323
Closed
1 of 3 tasks

System.IndexOutOfRangeException when loading an xlsx with pivot table #651

kelleadr opened this issue Jan 12, 2018 · 4 comments · Fixed by #1323
Labels

Comments

@kelleadr
Copy link

Read and complete the full issue template

Do you want to request a feature or report a bug?

  • Bug
  • Feature

Version of ClosedXML

0.87.1
also tested with 0.90

What is the current behavior?

A crash happens if i load the attached file (direclty within XLWorkbook constructor)

What is the expected behavior or new feature?

At least it shall load the excel and ignore the invalid data if there are any (excel itself says everything is fine)

Did this work in previous versions of our tool? Which versions?

Yes, different ones -> not related to this issue

Reproducibility

We loaded the xlsx directly from a memory stream in our application:
using (var memoryStream = new MemoryStream(report))
var book = new XLWorkbook(memoryStream);

But it also happens if you just open it by filename:
test.xlsx

Code to reproduce problem:

class Program
{
    static void Main(string[] args)
    {
        var book = new ClosedXML.Excel.XLWorkbook(@"test.xlsx");
    }
}
  • I attached a sample spreadsheet. (You can drag files on to this issue)
@igitur
Copy link
Member

igitur commented Jan 17, 2018

v0.90 should throw a meaningful ArgumentException with message There isn't a worksheet named 'Pivot Data'. Anyway, ClosedXML can't load the file because the pivot table refers to a non-existing sheet.

@igitur igitur added the invalid label Jan 17, 2018
@igitur igitur closed this as completed Jan 17, 2018
@kelleadr
Copy link
Author

thanks for checking the issue. However I think it should be possible to load an excel with missing references. Excel can do that without any warning. If you reference a different workbook, it might work if it is next to the one you open. I need to update the workbook and ignore the "currently" missing reference. Do you see any chance I can do that?

@igitur
Copy link
Member

igitur commented Jan 17, 2018

Sorry, that's not possible in the foreseeable future. We don't exactly have an entire Office development team here.

BillyFromAHill added a commit to BillyFromAHill/ClosedXML that referenced this issue Dec 16, 2019
Pankraty pushed a commit to BillyFromAHill/ClosedXML that referenced this issue Mar 21, 2020
@Pankraty
Copy link
Member

I am reopening this since @BillyFromAHill has provided a fix.

@Pankraty Pankraty reopened this Mar 21, 2020
@Pankraty Pankraty added bug and removed invalid labels Mar 21, 2020
igitur pushed a commit to BillyFromAHill/ClosedXML that referenced this issue Apr 12, 2020
Add a test workbook for loading pivot table with missing references (ClosedXML#651)
igitur pushed a commit to BillyFromAHill/ClosedXML that referenced this issue Apr 12, 2020
Add a test workbook for loading pivot table with missing references (ClosedXML#651)
igitur pushed a commit that referenced this issue Apr 12, 2020
Add a test workbook for loading pivot table with missing references (#651)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants