Corrupt Excel file if adding more than 11 PivotFieldType.PAGE to a Pivot Table

As per title, I’m generating a Pivot Table with Cells for Java. All is good until I add more than 11 fields to the pivot area “PivotFieldType.PAGE”. If I do, the excel file is corrput and Excel tries to recover it to no avail.

Please see the attached source and resulting xlsx file.

Thanks

App.zip (11.7 KB)

@red9350,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-43031 – Corrupt Excel file if adding more than 11 PivotFieldType.PAGE to a Pivot Table

1 Like

@red9350,
Please allocate enough space to page area, so you can change the code as follows:

int index =pivotSheet.getPivotTables().add("Sheet1!A1:Q8","A1","PivotTable");

To:

int index =pivotSheet.getPivotTables().add("Sheet1!A1:Q8","A15","PivotTable");

Why is this needed only for more than 11 filters though?

@red9350,

Does it work for any number of filters <11 you add (to page area) on your end?

@red9350,
If you add many PageFields to page area, the page filters will use the corresponding rows.
So if you create a PiovtTable in “A1”, after you add 5 PivotFields to page area. You should change “A1” to “A7”.

But if I add 11 or less PivotFilters and I create the table in A1, it is automatically moved down to the appropriate position. That’s what I’m asking: if it’s moved automatically for 11 or less filters, why isn’t it being moved for 12 or more? Is this an Excel bug?

@red9350,
We are analysing your comments and will share our feedback soon.