Charts coping from excel to image is not working

I am trying to copy chart from excel to image and its not coping plot area.


Excel file is attached with the mail. Also image that is copied is also attached.

Code used for coping:
List imageStream = new List();

//Open the xlsx file and copy all the charts as image into memory
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(a"1.xlsx");

if (workbook != null)
{
foreach (Chart chart in workbook.Worksheets[0].Charts)
{
//Rescale the chart before copying
chart.ChartObject.Height = Consts.ImageHeight;
chart.ChartObject.Width = Consts.ImageWidth;

MemoryStream chartStream = new MemoryStream();

//Convert the chart to an image file.
chart.ToImage(chartStream, ImageFormat.Png);
imageStream.Add(chartStream);

chart.ToImage(@“C:\imageChart.png”, ImageFormat.Png);
}
}

regards,
Aniket

Hi,

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

We have converted your chart to image using the latest version: Aspose.Cells
for .NET v7.5.1.3
with the following code. It converted the chart into image successfully without any issue. We have attached the output image file for your reference.

C#


Workbook workbook = new Workbook(path);


Worksheet worksheet = workbook.Worksheets[0];


Chart ch = worksheet.Charts[0];


Bitmap bmpChart = ch.ToImage();

bmpChart.Save(path + “.out.png”, ImageFormat.Png);


Hi,


I tried to use Aspose.cells 7.5.0.0 version and looks like the issue has not been fixed. Can you please check if its working with 7.5.0.0 version.

I am not able to update to 7.5.1.3 version because of license issue. Can you please provide me with any build that has the fix for above issue and which is release before 2nd July 2013.

Regards,
Aniket

Issue is resolved. Thanks for the support. Please ignore the previous post. Issue was due to chart height. Only Plot area used to get resized and if height was less then plot area was not seen.


Regards,
Aniket

Hi,

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

It is good to know that your issue is resolved now. If you face any other issue, please feel free to post, we will be glad to help you further.