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

Free Support Forum - aspose.com

Data plotted gets changed when the chart is copied as an image using chart.ToImage function


I am generating a chart and populating it in Excel file. Then I try to copy the chart from Excel and place it in word file as image. But strangely data points are different when we compare the chart in excel file and image in word file. Empty points are treated as Zero value.

Please find the details below:

Step 1: Create a chart and populated in Excel, chart is populated like expected.
Excel file is also attach with the mail.
Also the screen shot of chart is attached.

Step 2: Read the chart and place it in word report as image.
a) Code for reading the charts as image:
List imageStream = new List();
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(destinationDir + excelFileName);
if (workbook != null)
foreach (Chart chart in workbook.Worksheets[0].Charts)
chart.ToImage(chartStream, ImageFormat.Png);
b) Insert the chart in word report:
foreach (MemoryStream image in chartimages)
//Set paragraph format
builder.CurrentParagraph.ParagraphFormat.LineSpacingRule = LineSpacingRule.Multiple;
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Center;

//insert new paragraph
Paragraph paragraphForChart = builder.InsertParagraph();
//set chart format
Shape shape = new Shape(doc, ShapeType.Image);
shape.Height = height;
shape.Width = width;
shape.WrapType = WrapType.Inline;
shape.WrapSide = WrapSide.Both;
shape.Left = 0;

Every thing is coming as intended but the legends that has value as "{,100,100,100,100,100,100}"
while creating the chart, same while reading the chart. But some how after coping it into image, the chart in image format in word report looks like it has plotted values “{0,0,0,100,100,100,100,100,100}” {note : string is taken from chart object ((Aspose.Cells.Charts.Series)((new System.Collections.ArrayList.ArrayListDebugView(((System.Collections.CollectionBase)(chart.NSeries)).list)).Items[3])).Values }

Issue looks like a strange one. All the screen shoot are attach for the reference. Also the value axis labels (ie Min, Major values) get changed but I think the issue will get resolved if above issue get resolved.

Thank You,



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

Please download and use the latest version: Aspose.Cells for .NET 7.5.2 It works fine.

We have tested your issue with the following code using the latest version with your source file and it generates correct chart.

We have attached the output chart image for your reference.


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);


Thanks for the reply.

I am using Aspose version and I am seeing this issue. With latest version issue is resolved.

Can you please let me know any Aspose version that was released before 2nd of July that has this fix.



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

We check issue only in latest version. If we find any issue, we log it in our database for a fix. Your issue is fixed in the latest version and you will have to upgrade your license subscription to use it.

If you want to check previous version, then please get the previous versions from this link and try them at your end.