I am creating an Excel file with a pivot table (see source code in attached Aspose_test.zip/Aspose_test/src/main/java/org/example/Main.java). When I set pivotTable.setRefreshDataOnOpeningFile(false), the pivot table (see wrong.png) appears differently compared to when the parameter is set to true (see correct.png). Specifically, there are additional labels such as “Sum of Value 1” (see attachment). These labels are removed after I make any changes to the pivot table in Excel (e.g., refreshing data, changing the layout).
Is there a function I can call to generate the initial view without these artifacts?
It seems that the issue you’re experiencing with unwanted label repetition in your pivot table may be related to the layout settings of the pivot table in Excel. Specifically, the “Classic PivotTable layout” option can cause additional labels to appear, which are not present when the layout is set differently.
To address this issue programmatically using Aspose.Cells, you can try adjusting the layout of your pivot table. Here’s a code snippet that demonstrates how to set the pivot table layout to avoid these unwanted labels:
// Assuming you have already created your pivot table
PivotTable pivotTable = worksheet.getPivotTables().get(0);
// Set the layout to Tabular form to avoid classic layout issues
pivotTable.setRowGrandTotals(false);
pivotTable.setColumnGrandTotals(false);
pivotTable.setShowRowHeaders(false);
pivotTable.setShowColumnHeaders(false);
By modifying the layout settings, you should be able to generate the initial view of the pivot table without the additional labels. If the problem persists, consider refreshing the pivot table after making these adjustments, as this can sometimes resolve display issues.
If you continue to face challenges, please provide more details about your pivot table configuration, and I would be happy to assist further!
@mmidc
By testing with sample code on the latest version v25.3, we can reproduce the issue. The result file has unwanted label repeating after refreshing and calculating pivot table.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSJAVA-46334
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.