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

Free Support Forum - aspose.com

Chart distortion on embedded Excel OLE

Hi.

Our client, to whom we provide Aspose-generated PPT presentations containing Aspose-generated Excel OLE sheets, a chart and its data, is complaining that, when double-clicked (OLE accessed), and exited (image redrawn), the chart is distorted.

I know that some very comparable issues have been posted on this forum (6 months ago). But this is a really annoying drawback, that our client will not accept...

Have you found a solution yet ?

Or : is there a walk-around method you could advise so that this would not occur ?

Thanks a lot.

(Please find sample solution, with both initial and distorted chart in Result.ppt)

Yann Bicrel - Infocube France

I think it's not possible at the moment to simulate the Powerpoint 2007 "Insert Chart" procedure with Aspose.Slides, am I wrong ?

Is this feature planned any time ?

Thank you.

Yann Bicrel

Hi Bicrel,

According to your code example, you have created a chart with Aspose.Slides for .NET and embedded it in PPT as an OLE Object through OleObjectFrame. Further, the chart is rendered to an image and that image is assigned to OleObjectFrame. When you double click, the actual MS chart is activated in the Frame and when you click outside the Frame, image is no more shown. Rather the actual MS Excel chart is shown. As far as PowerPoint 2007 "Insert Chart" option is concerned, it is not planned yet, rather we will address issues found in the current approach. That is, MS Excel chart creation in Aspose.Cells and embedd them as OLE in presentation through Aspose.Slides.

Thank you for your reply.

I agree with your description of my process, but WHY is the MS Excel chart distorted when shown(like on my sample result) ?

How can I NOT get this ?

Thank you,

Yann Bicrel

Hi Bricel,

I shall have to investigate whether it is an issue on Aspose.Cells for .NET end as chart is actually created by Aspose.Cells for .NET. Otherwise, there might be problem on account of Aspose.Slides.OleObjectFrame behvior. After investigation, i shall respond to you soon.

Hi,

Do you have plans to support PowerPoint 2007 approach of "Insert Chart" in near future?

Is there any other way available than using OLE for PPT chart rendering?

-Muhammed

Hi Bicrel,

Thanks for your interest in Aspose.Slides.

Well, detailed investigation has been performed, and it is found that there is no issue on either Aspose.Cells or Aspose.Slides component. Actually, this is MS PowerPoint behavior. As a reverse approach, you can save the same MS Excel chart to the disk and further, you can insert it on a slide through MS PowerPoint. The resulting slide will look like the same way as you have slide no 2 in Result.ppt as created by you through Aspose components.

Thanks and Best Regards

Hi Muhammed,

Thanks for your interest in Aspose.Slides.

Although MS PowerPoint "Insert Chart" feature issue exists on our Issue Tracking System, however, it has not been planned at least for the near future. In addition to MS Excel chart creation through Aspose.Cells, Aspose also provides Aspose.Report component in order to create charts. For more information, visit Aspose.Report for .NET product pages here.

Best Regards

Hi,

I am not sure if this approach is going to work for you or not, but I wanted to share this information that you can also add the Excel chart as an image over slide object. Please have a look over the code snippet shared below in which first the chart in "simplechart.xls" file is accessed into Bitmap object and then I have simply placed it inside the shapes collection of slide using AddPictureFrame (...) method.

C# .NET

Workbook wb = new Workbook();
//Obatianing the filestream of the excel file containing the chart/charts in it
FileStream fstro = new FileStream("c:\\simplechart.xls", FileMode.Open, FileAccess.Read);
//Laoading the file stream of referenced excel file in workbook
wb.Open(fstro);

//Loading the chart in Bitmap. We've chart at worksheet3
Bitmap imgChart = wb.Worksheets[2].Charts[0].ToImage();
// create a presentation object
Presentation pres = new Presentation();
Slide slide = pres.GetSlideByPosition(1);
// Adding the Bitmap in the picture frame
Aspose.Slides.Picture pic = new Aspose.Slides.Picture(pres, imgChart);
//Adding the picture object to pictures collection of the presentation
//After the picture object is added, the picture is given a uniqe picture Id
int picId = pres.Pictures.Add(pic);
//Calculating picture width and height
int pictureWidth = pres.Pictures[picId - 1].Image.Width * 4;
int pictureHeight = pres.Pictures[picId - 1].Image.Height * 4;
//Calculating slide width and height
int slideWidth = slide.Background.Width;
int slideHeight = slide.Background.Height;
//Calculating the width and height of picture frame
int pictureFrameWidth = Convert.ToInt32(slideWidth / 2 - pictureWidth / 2);
int pictureFrameHeight = Convert.ToInt32(slideHeight / 2 - pictureHeight / 2);

//Adding picture frame to the slide
slide.Shapes.AddPictureFrame(picId, pictureFrameWidth, pictureFrameHeight,
pictureWidth, pictureHeight);
//Saving the ppt file
pres.Write("c:\\ImageSlide.ppt");

Hi.

Thank you for your piece of code.

In fact, my client wants to access the charts' data and modify them. So, we do need the Excel OLE (since Aspose is not ready yet to implement the Insert Chart feature of Powerpoint 2007, which is too bad really...). What my client also would like, is for the charts to look as fine as they used to when the OLE Object front Image had been created by Aspose.Cells.

Therefore, my current solution is to run, once the Presentation Excel charts data have been manually modified (and thus the corresponding pictures badly recreated by MS) and the Ppt saved + exited), a home-made application which recreates the OLE front pictures of all charts with Aspose.Cells. This works fine, except that my client will have to do some "post-treatment" on its Presentations...

Any ideas perhaps on how this application could be automatically launched after a save+exit event ? Thanks !

Here is the VB.NET code :

Dim file = "myReport.ppt"

Dim Pres As New Presentation(file)

For Each Sld As Slide In Pres.Slides

For Each Shp As Aspose.Slides.Shape In Sld.Shapes

If Not TypeOf (Shp) Is Aspose.Slides.OleObjectFrame Then Continue For

Dim OLE = CType(Shp, Aspose.Slides.OleObjectFrame)

Dim ms As New MemoryStream()

ms.Write(OLE.ObjectData, 0, OLE.ObjectData.Length)

ms.Seek(0, SeekOrigin.Begin)

Dim Book As New Workbook

Book.Open(ms)

Dim Cht = Book.Worksheets("ChartSheet").Charts(0)

Dim o As New ImageOrPrintOptions()

o.ImageFormat = Imaging.ImageFormat.MemoryBmp

Dim img As Bitmap = Cht.ToImage(o)

Dim pic As New Aspose.Slides.Picture(Sld.Parent, img)

OLE.PictureId = Sld.Parent.Pictures.Add(pic)

Next

Next

Pres.Save("myReport.ppt", Export.SaveFormat.Ppt)

Hi Bicrel,

Thanks for your interest in Aspose.Slides.

As already mentioned, issue is there for MS PowerPoint "Insert Chart" feature but it has not been planned as there are already high priority tasks on which we are working according to the schedule. As far as real MS Excel Chart alongwith its image created by Aspose.Cells for .NET is concerned, it is quite possible that you can get better options regarding cosmetic similarity between MS Excel Chart image and actual "save+exit" embedded MS Excel Chart from Aspose.Cells support team here.

Best Regards

Hi msabir,

I was refering to "save+exit" within Powerpoint.

Anyway... thank you for your link, but don't worry, I know where Aspose.Cells forum is when I need them (the answers I get from them are usually very relevant).

I shall leave you to your high priority tasks then, I'm only a customer after all.

Regards,

Yann BICREL - Infocube France

Hi Bicrel,

Thanks for the interest.

We are very sorry for the inconvenience. The point was regarding cosmetic similarity between embedded OLE Excel chart as viewd through MS PowerPoint and the actual MS Excel chart as viewed through MS Excel. The chart created in the current document look distorted after "Save+Exit" in MS PowerPoint. May be, some MS Excel chart with light cell borders don't look distorted in MS PowerPoint, after all, it is due to MS PowerPoint handling of OLE Objects. Once again, sorry for inconvenience.

Best Regards