Convert Chart into Image file using Aspose version 4.5.0.0

Hi All,

Am using Aspose version 4.5.0.0 in my application.

I generated Chart in worksheet using Aspose.Cells.

I need to convert that worksheet which contains chart into image.

Using Aspose version 5.0.0.0 am able to convert it but with version 4.5 am unable to do it.

Please help me to achieve this.

I used the below code,

Aspose.Cells.Charts.Chart imgChart1 = workbook.Worksheets[0].Charts[1];

imgChart1.ToImage(@"D:\Desktop_Items\ChartGenerateExample\Generate_Chart\WebApplication1\Images\AnnualChart.png", System.Drawing.Imaging.ImageFormat.Png);

The error am getting with version 4.5.0.0 is "The type name 'Chart' does not exist in the type 'Aspose.Cells.Charts'"

Thanks in advance.

Hi,


I am afraid the feature might not be available in the older version i.e. v4.5. However I can confirm the version v5.0 is good to convert charts to image files. If you could use v5.0 and your license allows to use this version, you should use it. Otherwise, I am afraid, you have to upgrade to our latest versions, e.g v7.1.1 which have tremendous features and other enhancements, Also, the Chart-to-Image and Shape/Worksheet to image and Excel to PDF features are there with lots of enhancements and accuracy.

By the way, for the issue:
The error am getting with version 4.5.0.0 is “The type name ‘Chart’ does not exist in the type ‘Aspose.Cells.Charts’”

Well, please use:
Aspose.Cells.Chart imgChart1 = workbook.Worksheets[0].Charts[1];

This is due to the fact from the release of v5.0.0 we did move certain apis to certain new namespaces . So the charts related APIs are moved to Aspose.Cells.Charts namespace but was not with the case with v4.5.

For reference check the API Reference pages for the product.

Thank you.