Free Support Forum - aspose.com

PivotTable and PivotChart doesnt refresh when saving to PDF

Hi there!


I’m having issues with pivot tables and pivot charts when saving teh workbook as PDF.

The issue with pivot table is that it does not have the refreshed data on the PDF, but it has it on the XLSX file.

The issue with pivot chart, is that when I put the RefreshChartCache on FALSE, the chart doesnt refresh, but when this attribute is true, the chart is not ok. It has the wrong X Axis, and the data is not displayed well.

See the image I’ve attached.


Example code:

sheet.Cells.ClearContents(1, 1, 13, 6);
sheet.Cells.ImportDataTable(data, false, 1, 0, 100, 6, false, “mm/dd/yy hh:mm AM/PM”, true);
sheet.ListObjects[“tbl_host_vulns_info”].Resize(0, 0, 100, 5, true);

foreach (PivotTable ptable in sheet.PivotTables)
{
ptable.ClearData();
string[] ds = new string[1];
ds[0] = “_mev_data!A1:F101”;
ptable.ChangeDataSource(ds);
ptable.CalculateRange();
ptable.RefreshData();
ptable.CalculateData();
}

foreach (Chart c in sheet.Charts)
{
c.RefreshPivotData();
c.Calculate();
}

I’ve attached an example.

Hope you can help me.

Thanks in advance!

Hi,

Thanks for your posting and using Aspose.Cells.

I have tested this issue with your sample code using the latest version: Aspose.Cells for .NET 8.5.0 by uncommenting the following red line

if (format.Equals(SaveFormat.Pdf))
{
PdfSaveOptions opts = new PdfSaveOptions(SaveFormat.Pdf);
opts.RefreshChartCache = true;
opts.AllColumnsInOnePagePerSheet = true;
filename += “.pdf”;
wb_b.Save(filename, opts);
}

and it generated the correct pdf. I have attached the output pdf generated by your code for your reference.

Ok the chart, but what about the pivot table?


It still has the un-refreshed data. The pivot table in the file output.pdf has the same data as the test.xlsx when it shouldn’t.

Thanks!

Hi,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue and found pivot table is not refreshed when saved to pdf.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43744 - PivotTable does not refresh when saving to PDF

Hi Shakeel,


Is there any update on this?

Thanks in advance!

Hi,

Thanks for your posting and using Aspose.Cells.

We are afraid, there is no update for you at this moment. However, we have logged your comment in our database against this issue and requested the product team to provide fix or some ETA for this issue. Once, there is some news for you, we will let you know asap.

Hi,

Thanks for using Aspose.Cells.

It is to inform you
that this issue should be fixed in about July 24, 2015. Once the fix is
available for you, we will provide it you and notify you in this thread.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells
for .NET v8.5.0.4
and let us know your feedback.

About CELLSNET-43744, there are some tips for you.

1.In testing project named “AposeTests”, you only refresh the PivotTables in the Worksheet named “_mev_data”.

2.If you want to refresh the PivotTables in the Worksheet named “Most Exploited Vulns”.

Please change the codes as follows:

foreach (Chart c in sheet.Charts)

{

c.Calculate();

c.RefreshPivotData();

}

To:

sheet = wb_b.Worksheets["Most Exploited Vulns"];

foreach (PivotTable ptable in sheet.PivotTables)

{

ptable.RefreshData();

ptable.CalculateData();

}

foreach (Chart c in sheet.Charts)

{

c.Calculate();

c.RefreshPivotData();

}

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.