PivotChat to Image

Hi,

if I convert a pivot chart or a sheet with a pivot table to an image, the image is empty. Is the converting to image of pivot charts supported?

Best regards

Hi,

Thanks for your posting and using Aspose.Cells for Java.

There should be any problem converting the worksheet into image having a pivot chart.

If you face any problem, please provide us your source xls/xlsx file which you are converting to image, we will check it soon.

Please also download and try the latest version:
Aspose.Cells
for Java v7.3.0.4

and see if it fixes your problem.

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normale Tabelle"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;}

<![endif]–>

Hi,

Thank you for the quickly answer. In the attachment is the Excel file, which I have used to convert a pivot chart to an image and the image, which I become after conversion.

Best Regards

Hi,


I can notice the issue as you have mentioned. The output image is blank.

Sample code:

Workbook workbook = new Workbook(“pivotChart_test.xls”);

//I added a few lines to refresh and calculate the pivot table
workbook.getWorksheets().get(1).getPivotTables().get(0).refreshData();
workbook.getWorksheets().get(1).getPivotTables().get(0).calculateData();

Chart chart = workbook.getWorksheets().get(2).getCharts().get(0);

//Add some lines to calculate the chart and workbook
chart.calculate();
workbook.calculateFormula();

chart.toImage(“myimgpvtchart.bmp”);


I have logged a ticket with an id: CELLSJAVA-40290. We will look into it soon.

Thank you.
geomagic:

Hi,

Thank you for the quickly answer. In the attachment is the Excel file, which I have used to convert a pivot chart to an image and the image, which I become after conversion.

Best Regards
Hi,

We have looked into your issue and found your template file is corrupt, it displays error in Ms-Excel 2010 and 2003.

Please provide us correct template file.

Hi,


Please try the new release (you may download it @: http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry405613.aspx) and add the following code segment if you want the Excel 2007 or later chart.

Workbook.setFileFormat(FileFormatType.XLSX)


Thank you.

Hi,

Many thanks for the fast bug fixing. A pivot chart can now be exported to an image.

But I found another problem. If the field type PivotFieldType.COLUMN will be not set for the pivot table only the chart grid lines will be exported to an image.

Kind Regards

Hi,


"But I found another problem. If the field type PivotFieldType.COLUMN will be not set for the pivot table only the chart grid lines will be exported to an image."

Kindly create a sample console application or paste your runnable code with template files to reproduce the issue. We will check your issue soon.

Thank you.

Hi,

I have attached the Excel file, that I have used. I have converted the pivot chart to image as follows:

Workbook workbook = new Workbook(“d:\tests\aspose\pivotChart_test.xls”);
Worksheet pivotChartSheet = workbook.getWorksheets().get(2);
Chart chart = pivotChartSheet.getCharts().get(0);
ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();
imgOpts.setImageFormat(ImageFormat.getPng());
File chartImageFile = new File(“d:\tests\aspose\chartimage.png”);
chart.toImage(chartImageFile.getAbsolutePath(), imgOpts);

Kind regards
Olga

Hi,

Thanks for your sample code.

We were able to replicate this issue using the latest version:

Aspose.Cells for Java 7.3.1
.

I tried using Chart.calculate() and Workbook.calculateFormula() but they are also not working. Similarly, PivotTable.refereshData() and PivotTable.calculateData() are also not giving expected results.

We have logged your file, code and comments in our database. We will look into your issue and fix this issue. Once the issue is fixed or we have some other update/advice for you, we will let you know asap.

Java


String filePath = “F:\Shak-Data-RW\Downloads\pivotChart_test.xls”;


Workbook workbook = new Workbook(filePath);


Worksheet pivotChartSheet = workbook.getWorksheets().get(2);

Chart chart = pivotChartSheet.getCharts().get(0);


ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();

imgOpts.setImageFormat(ImageFormat.getPng());


File chartImageFile = new File(filePath + “.out.png”);

chart.toImage(chartImageFile.getAbsolutePath(), imgOpts);

Hi,


Well, if I add two lines (as pasted below in bold) to your code regarding calculating and refreshing pivot table, the pivot chart is rendered in the output image but it is not identical to the original chart, I have logged it and we will look into it soon.

Sample code:

Workbook workbook = new Workbook(“pivotChart_test.xls”);
Worksheet pivotChartSheet = workbook.getWorksheets().get(2);
workbook.getWorksheets().get(1).getPivotTables().get(0).refreshData();
workbook.getWorksheets().get(1).getPivotTables().get(0).calculateData();
Chart chart = pivotChartSheet.getCharts().get(0);
ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();
imgOpts.setImageFormat(ImageFormat.getPng());
File chartImageFile = new File(“chartimage.png”);
chart.toImage(chartImageFile.getAbsolutePath(), imgOpts);

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan