Creating a pivot chart from the pivot table in the previous post, the chart shows the sums in the sorted order (see Test.xlsx attached).
If I then export the workbook to PDF using the following code:
Workbook book = new Workbook(@“Test.xlsx”); foreach (Worksheet ws in book.Worksheets) { int chartchount = ws.Charts.Count; for (int i = 0; i < chartchount; i++) { if (!string.IsNullOrEmpty(ws.Charts[i].PivotSource)) ws.Charts[i].RefreshPivotData(); ws.Charts[i].Calculate(); } } book.Save(@“Test.pdf”, SaveFormat.Pdf);
The resulting chart in the PDF looks different from the chart shown in Excel. In particular, the sort order is wrong, and the first data item is missing its label. Help!
We have evaluated your first scenario against the latest version of Aspose.Cells for .NET 8.3.2.3, and we are able to confirm the issue. The Pivot Field’s sorting is changed after rendering the spreadsheet to PDF. We have logged the issue in our bug tracking system under the ticket CELLSNET-43416 for further investigation & correction purposes. Please spare us little time to properly analyze the problem cause, and to provide the fix at earliest possible.
We are currently evaluating your presented scenario, and we will shortly get back to you with updates in this regard.
Creating a pivot chart from the pivot table in the previous post, the chart shows the sums in the sorted order (see Test.xlsx attached).
If I then export the workbook to PDF using the following code:
Workbook book = new Workbook(@"Test.xlsx"); foreach (Worksheet ws in book.Worksheets) { int chartchount = ws.Charts.Count; for (int i = 0; i < chartchount; i++) { if (!string.IsNullOrEmpty(ws.Charts[i].PivotSource)) ws.Charts[i].RefreshPivotData(); ws.Charts[i].Calculate(); } } book.Save(@"Test.pdf", SaveFormat.Pdf);
The resulting chart in the PDF looks different from the chart shown in Excel. In particular, the sort order is wrong, and the first data item is missing its label!
Thanks for the sample code and details.
After an initial test, I observed the issue as you mentioned. I found the sort order of
PivotChart's series data points is wrong with missing first point label
after refreshing the pivot chart and calculating its data in the output
PDF file format.
e.g
Sample code:
Workbook book = new Workbook(@"e:\\test2\\Test.xlsx");
foreach (Worksheet ws in book.Worksheets)
{
int chartchount = ws.Charts.Count;
for (int i = 0; i < chartchount; i++)
{
if (!string.IsNullOrEmpty(ws.Charts[i].PivotSource))
ws.Charts[i].RefreshPivotData();
ws.Charts[i].Calculate();
}
}
book.Save(@"e:\\test2\\out1.pdf", SaveFormat.Pdf);
I have logged a ticket with an id "CELLSNET-43417" for your issue. We will look into it soon.
Once we have any update on it, we will let you know here.
It is good to know that one of your issue is resolved with the latest fix. Regarding your other issue, we got the following information from product team.
It is not supported that sorting the PivotField according to DataField or other PivotFields. We only support sorting the PivotField by itself, ascending or
descending.If you want to sort the PivotField according to DataField or
other PivotFields,when you call the method “PivotTable.CalculateData()”,
it may generate unexpected result.
This is to inform you that we have fixed your issue “CELLSNET-43416” now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
The issues you have found earlier (filed as CELLSNET-43416) have been fixed in Aspose.Cells for .NET v19.10. This message was posted using Bugs notification tool by Amjad_Sahi