Hi, I’m testing Aspose.Cells Java to convert xlsx to pdf.
Hi,
Hi Andrea,
Thank you for contacting Aspose support.
I have evaluated the presented scenario while using the following piece of code against the latest version of Aspose.Cells for Java 8.9.2.6. I am afraid, I am not able to see any problem in the resultant PDF as the Pivot Table has been refreshed according to the new data source. Please note, the Aspose.Cells APIs currently do not support Pivot Table recalculation in case the data source is external. However, if the data source resides in the same spreadsheet, you can refresh the Pivot Table on similar lines.
In case the problem persists, please provide us an executable sample application (or Java code) along with the input spreadsheet for further investigation.
Java
PivotTable pivot = book.getWorksheets().get(0).getPivotTables().get(0);
System.out.println(pivot.getDataSource()[0]);
for (int i = 2; i < 12; i++)
{
System.out.println(book.getWorksheets().get(0).getCells().get(“G” + i).getValue());
}
pivot.changeDataSource(new String[] { book.getWorksheets().getRangeByName(“testRange”).getRefersTo() });
System.out.println(pivot.getDataSource()[0]);
pivot.setRefreshDataFlag(true);
pivot.refreshData();
pivot.setRefreshDataFlag(false);
pivot.calculateData();
for (int i = 2; i < 12; i++)
{
System.out.println(book.getWorksheets().get(0).getCells().get(“G” + i).getValue());
}
book.save(dir + “output.xlsx”);
book.save(dir + “output.pdf”);
Hi, I attach my xlsx,
Hi,
I send you test.zip, with a simple console app, when i run it, the pivot remains with field “Bar” while data table name is "Bar test"
Hi,
e.g
Sample code:
Workbook asposeWorkbook = new Workbook(“sample1.xlsx”);
for (int i = 0; i < asposeWorkbook.getWorksheets().getCount(); i++) {
Worksheet asposeWorksheet = asposeWorkbook.getWorksheets().get(i);
for (int j = 0; j < asposeWorksheet.getPivotTables().getCount(); j++) {
PivotTable pt = asposeWorksheet.getPivotTables().get(j);
try {
System.out.println(pt.getName());
System.out.println(asposeWorksheet.getName());
pt.refreshData();
pt.calculateData();
}
catch (Throwable t) {}
}
asposeWorkbook.save(“out1.pdf”, SaveFormat.PDF);
Hi,
Hi Andera,
Hi,
Hi,
The issues you have found earlier (filed as CELLSJAVA-41974) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.