We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issues with Charts

Hi,
We are using Aspose.Cells for .NET 17.7 and got an issue with documents containing charts. We open input XLSX file and convert it to PDF. Aspose.Cells draws charts as graphical objects and does it don’t like Microsoft Excel. Please compare charts in TwoPagesXlsXChart.pdf and TwoPagesXlsXChart.xlsx.pdf in attached ZIP. Aspose.Cells makes charts with different size, adds the numbering, and last chart is rotated.

I’m also interesting if there are any options that allow to draw charts as pictures instead of graphic objects when converting to PDF?

In attached ZIP:

TwoPagesXlsXChart.xlsx - input XLSX file;
TwoPagesXlsXChart.xlsx.pdf - PDF file generated by Aspose.Cells;
TwoPagesXlsXChart.pdf - PDF file genersted by Microsoft Excel;

Thanks,
Roman

Charts.zip (172.9 KB)

@cap.aspose

Thanks for using Aspose APIs.

We checked your attached Charts.zip and did not find any XLSX file (please see the screenshot below). Please provide us your Excel file. Besides, add comments inside the Aspose generated Pdf so that we could see your issues precisely. Although, chart rotated issue is clear but you should add comments for other issues. We will look into your issues and help you asap.

Sorry I forgot to add initial XLSX file in archive. It’s included in the ZIP in this message.

Let’s compare second charts in both PDF files. In PDF file generated by MS Excel second chart looks like in initial XLSX file. On the vertical axis there are numbers 0, 2, 4, 6, and 8, as in the original XLSX file. In PDF file generated by Aspose.Cells, in addition to these numbers, numbers 1, 3, 5, and 7 are added.

The same is observed on the third and fourth charts.

The height of the second and third charts in the PDF file generated by Aspose is increased. They are also shifted slightly to the right and up.

About the fact that the last chart is rotated, I wrote in a previous message.

And one more thing that interests me. In PDF file generated by MS Excel, charts are drawn as bitmap images. There is a possibity to select, copy and past them in other application for example in Paint. In PDF file generated by Aspose.Cells, charts are drawn as graphical objects and I can’t copy them to clipboard.

Is there some options in Aspose.Cells that allow to draw charts in PDF files as images instead of graphical objects?

In attached ZIP:

TwoPagesXlsXChart.xlsx - input XLSX file;
TwoPagesXlsXChart.xlsx.pdf - PDF file generated by Aspose.Cells;
TwoPagesXlsXChart.pdf - PDF file genersted by Microsoft Excel;

Thanks,
Roman

Charts.zip (190.2 KB)

@cap.aspose

Thanks for considering Aspose APIs.

We will look into this issue and update you asap.

Thanks for the answer.

I would like to get an answer to the last question from my message above, about the possibility to generate PDF files with charts in the form of bitmap images.

In PDF files, generated by MS Excel,user in Acrobat Reader can click on chart and copy it to clipboard. In PDF files, generated by Aspose.Cells, user can’t select chart and copy it, because they are drawn not as bitmap images.

I tried to convert initial file to PDF by two ways using such code:

using (var workBook = new Workbook(inputStream))
{
workBook.Save(outputStream, SaveFormat.Pdf);
}

and by this way:

using (var workBook = new Workbook(inputStream))
{
workBook.Save(outputStream, SaveFormat.Pdf);
PdfSaveOptions options = new PdfSaveOptions();
options.ImageType = System.Drawing.Imaging.ImageFormat.Png;
workBook.Save(outputStream, options);
}

Is there some options in Aspose.Cells API, that allow to draw charts in output PDF files as images which can be selected in Acrobat Reader and copied to clipboard?

Thanks,
Roman

@cap.aspose

This issue has been logged as

  • CELLSNET-45677 - User can select or copy Charts from MS-Excel Pdf unlike Aspose.Cells Pdf in Adobe Reader

For other issues, we will update you asap.

@cap.aspose

Thanks for considering Aspose APIs.

Your other issue has been logged as

  • CELLSNET-45684 - Chart to Image or Pdf - 3D Line Chart is not correct or rotated

@cap.aspose,

Please try our latest version/fix: Aspose.Cells for .NET v17.10.1:

Your issue “CELLSNET-45684” should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-45684) have been fixed in this Aspose.Cells for .NET 17.11 update.

Please also check the following article:

Hi,

Thank you for reply.

I downloaded Cells 18.1 and generated PDF by this version.

The chart rotation is corrected.
However, the location within the regions, the dimensions and information along the axes is still different from the PDF file generated by MS Excel.

Please compare TwoPagesXlsXChart.xlsx1801.pdf , generated by Cells version 18.1, with TwoPagesXlsXChart.pdf from my ZIP, attached to my first post.

Thanks,
Roman

@cap.aspose,

Thanks for the sample PDF file and details.

I have evaluated your issue by converting your original template file to PDF file format using our latest version/fix (v18.2.2). I found vertical axis labels are not completely matched with the original charts in MS Excel. Only first chart (in the first worksheet) has identical x-axis and y-axis labels.

Please provide some screenshots to highlight the problematic areas (by encircling in red color) while comparing original charts (in MS Excel) and rendered charts in PDF by Aspose.Cells. This will help us to log the issue precisely to consequently figure it out soon accurately.

Hi,

In attached ZIP I provided screenshots of charts from TwoPagesXlsXChart.pdf and TwoPagesXlsXChart.xlsx1801.pdf in same scale. I marked problematic areas with the red lines. You can see, that positions and scales are not the same. The first chart looks better than all the others. The second, third and fourth are very different.

And please pay attention to the arrangement of the words Series1 and Series2

The best way to compare results is open both files in Adobe Reader, set the same scales and quickly switch between windows. So all the differences are clearly visible.

Thanks,
Roman

Screenshot.zip (309.9 KB)

@cap.aspose,

Thanks for the screenshots.

I am able to observe the issue as you mentioned via your screenshots (https://forum.aspose.com/uploads/discourse_instance3/11625). I found that chart objects/elements location within the regions, dimensions and information along with the vertical axis are different a bit when matching the output PDF file by Aspose.Cells with the PDF generated by MS Excel.

I have logged a ticket with an id “CELLSNET-45931” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Hi,

I downloaded the latest version of the Cells (19.1), and checked the issues described above. I see that an issues with the id CELLSNET-45931 are still observed in this version.

Is there any updates on this issue?

Thanks,
Roman

@cap.aspose,

I am afraid your mentioned issue “CELLSNET-45931” is still not resolved yet. I have logged your concerns against your issue into our database and once we have an update on it, we will let you know here.

Thank you for the answer.

Tell me please are there any updates or plans to implement charts drawing as bitmap images? This issue has been logged as CELLSNET-45677 in your tracking system.

Thanks,
Roman

@cap.aspose,

I am afraid for your mentioned issue “CELLSNET-45677”, we have not implemented it. I have logged your concerns against your issue into our database and once we have an update or ETA on it, we will let you know.

@cap.aspose,

Regarding issue “CELLSNET-45677”, after some more research, It seems that Microsoft Excel converts chart to picture only when the chart is complex (e.g. 3D effects). If you convert the attachment “test.xlsx” in the zipped archive (attached) to PDF file format manually in Microsoft Excel, you will find the simple chart in it is not converted to picture.

We can add an API to control to convert the whole chart to Bitmap (e.g. png) picture. However, Microsoft Excel does not convert whole chart to picture. See the screenshot “compare.png” from the zipped archive (attached), on the left side, the blue area is what Microsoft Excel does, on the right side, the blue area refers to what Aspose.Cells plans to do. Is it OK for you?
files1.zip (68.8 KB)

@cap.aspose,

For the ticket “CELLSNET-45931”, I am afraid these issues cannot be fixed.

  1. Chart objects/elements location information is not saved in the Excel file. We cannot figure out exactly the same as MS Excel.
  2. The labels of vertical axis are not same as Excel. As the major unit of axis is automatic and this issues are too complex to figure these out. Now we cannot do the same as per MS Excel. We think if the labels are not overlapping, these should be considered as right. The count of labels is related to chart’s size. If you drag the chart in Excel to make the chart size change, you will find the labels are changed too.

Hi,

Regarding the issue “CELLSNET-45677”, it will be ok for us if you implement a possibility to convert whole chart to bitmap.

But if you enhance API for this we need that Cells would automatically detects how to draw chart.
For example if we set an option to draw chart as bitmap, Cells have to do it only in situations when Microsoft Excel does it. If Microsoft Excel does not draw chart as bitmap Cells also must not draw chart as bitmap even if an option is set.

Thanks,
Roman