Hi,
After calling PivotTable.RefreshData method seems the content of the workbook is corrupted.
The exception thrown when trying to use the content after calling the method is:
"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at Aspose.Cells.Pivot.PivotFieldCollection.get_Item(Int32 index)"
To reproduce the issue please use the attached file and the following code:
var workbook = new Workbook(“test.xls”);
foreach (var worksheet in workbook.Worksheets)
{
foreach (var pivotTable in worksheet.PivotTables)
{
if (pivotTable.RefreshDataOnOpeningFile)
pivotTable.RefreshData();
}
var memoryStream = new MemoryStream();
workbook.Save(memoryStream, SaveFormat.Excel97To2003);
var newWorkbook = new Workbook(memoryStream);
Thank you,
Aurelian Iordache
Software Developer
IBM Romania
Hi,
sample code, I got the exception when opening the saved file from memory
stream:
“Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index”
e.g
Sample code:
Workbook workbook = new Workbook("e:\\test2\\test.xls");
foreach (Worksheet worksheet in workbook.Worksheets)
{
foreach (PivotTable pivotTable in worksheet.PivotTables)
{
if (pivotTable.RefreshDataOnOpeningFile)
pivotTable.RefreshData();
}
}
var memoryStream = new MemoryStream();
workbook.Save(memoryStream, SaveFormat.Excel97To2003);
memoryStream.Position = 0;
var newWorkbook = new Workbook(memoryStream);
Hi,
Thanks for your using Aspose.Cells.
Please download and try the latest fix: Aspose.Cells for .NET v8.3.2.3 and let us know your feedback.
The issues you have found earlier (filed as CELLSNET-43337) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hello,
It seems that this bug has only been partially fixed. It does not throw the ‘Index out of range’ exception anymore but the file is still reported corrupt by Excel:
"Excel was able to open the file by repairing or removing the unreadable content.
Repairs were made to PivotTable report ‘Draaitabel1’ on ‘[test.xls]Pivot’."
I have attached the xls document used and this is the code used to reproduce this behaviour:
—
var excelDocument = new Workbook(“test.xls”);
foreach (var pivotTable in from worksheet in excelDocument.Worksheets from pivotTable in worksheet.PivotTables where pivotTable.RefreshDataOnOpeningFile select pivotTable)
{
pivotTable.RefreshData();
}
excelDocument.Save(“test_out.xls”, SaveFormat.Excel97To2003);
—
InternalID: 14276
Thank you,
Stanescu Jean-Alexandru
Junior Developer
IBM Romania
Hi,
Sample code:
Workbook workbook = new Workbook(“e:\test2\test.xls”);
foreach (Worksheet worksheet in workbook.Worksheets)
{
foreach (PivotTable pivotTable in worksheet.PivotTables)
{
if (pivotTable.RefreshDataOnOpeningFile)
pivotTable.RefreshData();
}
}
workbook.Save(“e:\test2\out1.xls”, SaveFormat.Excel97To2003);
The issues you have found earlier (filed as CELLSNET-43786) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hello again,
It seems that the issue is fixed only with the file provided. It is still reproducible with the attached file and following code:
var excelDocument = new Workbook(“testFile.xls”);
foreach (var pivotTable in from worksheet in excelDocument.Worksheets
from pivotTable in worksheet.PivotTables
where pivotTable.RefreshDataOnOpeningFile
select pivotTable)
{
pivotTable.RefreshData();
}
excelDocument.Save(“testOut.xls”, SaveFormat.Excel97To2003);
When opening testOut.xls, it says it is corrupted and repairs it: PivotTable report ‘Draaitabel1’ on ‘[testOut.xls]Log’ was discarded due to integrity problems.
InternalID: 14276
Best regards,
Stanescu Jean-Alexandru
Junior Developer
IBM Romania
Hi,
Hi,
Hi,
Thanks for your posting and using Aspose.Cells.
Such issue can occur on different type of pivot tables with different type of reasons. So we recommend you first download and try the latest version: Aspose.Cells
for .NET v8.5.2.3 and see if it does resolve your issue.
If your issue still occurs, then please provide us your source excel file containing your pivot table and causing this issue. We will look into it and help you asap. Thanks for your cooperation.
Hello. Do you happen to have an update for our issue CELLSNET-43786? Thanks!
Hi Raluca,
Hi,
Thanks for using Aspose.Cells.
This is to inform you that we have fixed your issue CELLSNET-43786 now. We will soon provide the fix after performing QA and including other enhancements and fixes.
Please spare us some time till 30th October 2015. Hopefully, you will get a fix till then.
Hi,
Thanks for your using Aspose.Cells.
Please download and try the latest fix: Aspose.Cells for .NET v8.6.1.1 and let us know your feedback.
Hello,
I have tested the scenario with your latest version and, indeed, it seems to work. Could you please provide the Cells v8.6.1.1. for .NET Framework 4.5?
Best regards,
Jean-Alexandru Stanescu
Junior Developer
IBM Romania
Hi,