Hi,
I tried using the following code that I picked up from one of the threads to convert an excel chart into an Image and I have two queries about that
1) I used the following code
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
workbook.Open(@"C:\Sheets.xls");
Aspose.Cells.Chart chart = workbook.Worksheets[0].Charts[0];
Bitmap bitmap = chart.ToImage();
bitmap.Save(@"C:\Test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
When I tried running the above code, I got an "OverFlow exception" at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
I then modified the above code as follows
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
workbook.Open(@"C:\Sheets.xls");
Aspose.Cells.Chart chart = workbook.Worksheets[0].Charts[0];
workbook.Save(@"C:\Text.xls");
Bitmap bitmap = chart.ToImage();
bitmap.Save(@"C:\Test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
and the error disappeared.
Why is this happening?
2) When I saved the image from the code above, I could not see anything in the image, everything was white and all I got was a white square. Why is the formatting from the excel sheet not getting saved? I have attached the excel file I am using
Thanks in advance