Free Support Forum - aspose.com

Is it possible to get chart from Aspose.Cells as image?

Hi!

Could you please tell me if it is possible to generate chart using Aspose.Cells and then save it as image?

Thanks,
Igor

Hi Igor,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Yes, Aspose.Cells for .NET supports creation and conversion of Chart to Image. Please see the following documentation links for code samples and further details.

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/converting-chart-to-image.html

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/convert-an-excel-chart-to-image.html

Thank You & Best Regards,

Thank you!

It works, but colors change after converting.

Is there any solution to this?

Thanks,
Igor

Response.Clear();

Response.ContentType = "image/png";

Workbook workbook = new Workbook();

string path = this.MapPath("/");

workbook.Open(path + "2003.xls");

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

System.Drawing.Bitmap image = chart.ToImage();

image.Save(Response.OutputStream, ImageFormat.Jpeg);

Hi Igor,

Thanks for providing us the template file.

Well, I think you have created/changed the chart in MS Excel 2007 manually, so you may get different color for the bars. You may check to open the file into both MS Excel 2007 and MS Excel 2003 separately and you will get different views for the chart in it. Please use MS Excel 2003 to change the color of the bar, you can directly modify the excel file with excel 2003. We will continue to look into the issue if we can enhance it more accordingly. Also, we have found an issue i.e…, “Some labels are missed in the chart image”, we will try to fix this issue on the week end. Moreover, just for your knowledge, you have applied “Shadow” function to the border of the bar, I am afraid, Aspose.Cells for .NET does not support it in the chart’s conversion.

Your issue has been logged into our issue tracking system with an issue id: CELLSNET-11346.

Thank you.

Hi,

Thank you for considering Aspose.

We have fixed the data label issue. But I am afraid the bar colors issue is not resolved yet. You may modify the colors again using Excel 2003.

Thank You & Best Regards,

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.