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.

Hi,

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

lic.SetLicense(context.Server.MapPath("~/Licenses/Aspose.Total.Lic"));

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

lic2.SetLicense(context.Server.MapPath("~/Licenses/Aspose.Total.Lic"));

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.Open(chart);

wd.Workbook.Worksheets[1].Cells["B2"].PutValue(50);

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/vnd.ms-powerpoint";

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;

pres.Write(st);

Hi,

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 4.4.3.1 . It looks like the 4.4.3.10 that you posted fixed the line drawing portion of the issue. I look forward to the fix for the datatable portion.

Thanks!

Hi,

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!