Workbook gets corrupted when removing a sheet which has a pivot table

hi, my application uses template files that have several sheets with pre-configured pivot tables+charts which link to tables. if i remove a sheet that has a table which is linked to a pivot table and the sheet with the pivot table i get a warning when opening in excel because the PivotCache is still referenced in the XML even though the sheets/tables are gone. i have attached a sample template and code to reproduce.


Workbook wb = new Workbook(templatePath);
wb.Worksheets.RemoveAt(0);
wb.Worksheets.RemoveAt(0);
wb.Save(
templatePath + “.out.xlsx”);

Hi,

Thanks for your reporting and using Aspose.Cells for .NET.

We were able to replicate the problem using the latest version. We have logged this issue in our database.

Development team will look into this issue and fix the problems and once the issue is fixed or we have some other update relating to it, we will let you know asap.

This issue has been logged as CELLSNET-40469.

Hi,

We have fixed. this issue. Please download and try this fix: Aspose.Cells for .NET v7.1.2.1

hi, thanks for the quick turnaround. while this fix does seem to work for the sample template i attached in the first post, it now causes a causes a crash in the WorksheetCollection.RemoveAt(Int32 index) method when running on a more complicated template. please retry my original code on the attached template.



exception:
Collection was modified; enumeration operation may not execute.
at System.Collections.Hashtable.HashtableEnumerator.MoveNext()
at Aspose.Cells.WorksheetCollection.RemoveAt(Int32 index)

Hi,

Thanks for providing us the new template file.

Yes, I got the exception (you mentioned) using your newly attached file: Lease_Pivot_Template.xlsx (Workbook gets corrupted when removing a sheet which has a pivot table).
I have reopened your issue “CELLSNET-40469” again and we will soon look into it.

Thank you.

Any update on this issue?

Hi,


I have asked the relevant developer working over your case to update on it. Once we have any update, we will let you know immediately here.

Thank you.

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET v7.1.2.2

Currently, I am no longer able to add PivotFields to the Data area without the following CellsException being thrown: "You could not add data field to the data fields"


I am using the attached report with the code snippet below.

PivotTable pt = m_currentWorkbook.Worksheets[1].PivotTables[0];
for (int year = 2009; year <= 2012; year++)
{
PivotField field = pt.BaseFields[year.ToString()];
if (field != null)
pt.AddFieldToArea(PivotFieldType.Data, field);
}

Hi,

Thanks for your feedback.

I was able to reproduce the problem using the latest version:
Aspose.Cells
for .NET v7.1.2.2

with your code.

We have logged your comment in our database against the issue id: CELLSNET-40469

We will look into it and fix the problems.

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET v7.1.2.3

The issues you have found earlier (filed as CELLSNET-40469) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.