Free Support Forum -

Chart ToImage drawing incorrectly

I'm using WorkBookDesigner of Aspose.Cells to open an embeded OLE object in a powerpoint file, modify the data and then writing the updated file back to the OLE object. That is all working great, but in order to overcome the "Object Changed" message that my customers have rightfull declared unacceptable I'm attempting to fix it with a picture but am finding the Chart.ToImage() function is working poorly. Here is a sample image of what the function is outputting and what it actually looks like.

It's three standard line graphs with the markers turned off for the last series. The first series gets made correctly but the other two have some odd things about them.

The Actuals series gets zero's put in for values that should just be absent.

The Burn series gets zero's put in at the beginning and the line is charted very strangely. It somehow curves despite the fact it's a line graph.

Any help would be appreciated.


Thanks for considering Aspose.

Could you post your source template Excel file here, we will check your issue soon.

Thank you.

I'm using the one embeded in the powerpoint file as my source using the following code:

//Set the Licenses

Aspose.Cells.License lic = new Aspose.Cells.License();


Aspose.Slides.License lic2 = new Aspose.Slides.License();


Presentation pres = new Presentation(context.Server.MapPath("~/Templates/Source.ppt"));

pres.Author = "Author";

pres.Company = "Company";

Slide slide = pres.Slides[0];

slide.Name = "Errors";

OleObjectFrame chartoof = (OleObjectFrame)slide.FindShape("Chart");

if (chartoof != null)


MemoryStream chart = new MemoryStream(chartoof.ObjectData);

Aspose.Cells.WorkbookDesigner wd = new Aspose.Cells.WorkbookDesigner();



wd.Workbook.Worksheets.SetOleSize(1, 1, 1, 1);

Bitmap graphPic = wd.Workbook.Worksheets[0].Charts[0].ToImage();

int graphPicID = pres.Pictures.Add(new Picture(pres, graphPic));

chartoof.ObjectData = wd.Workbook.SaveToStream().ToArray();

chartoof.PictureId = graphPicID;


context.Response.ContentType = "application/";

context.Response.AppendHeader("Content-Disposition", "attachment; filename=output.ppt");

context.Response.Flush(); //Flushing the buffers of Http Response

System.IO.Stream st = context.Response.OutputStream;



Thanks for the providing us the code.

Which version of Aspose.Cells for .NET you are using. Kindly try the attached version if the line series rendered fine.

For default zeros (input) in place of nulls / blank values in the chart's data table, we will look into it and figure it out soon.

Thank you.

I was using . It looks like the that you posted fixed the line drawing portion of the issue. I look forward to the fix for the datatable portion.



Please try this fix.

If you want to get a vector image, please use Chart.ToImage(string imageFile, System.Drawing.Imaging.ImageFormat imageFormat) method.

The new version of the .dll seems to correct the null data chart values issue. Thanks for the suggestion on using a vector image, it looks a lot better!