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

Free Support Forum - aspose.com

Adding two excel charts to the same slide in a presentation PPTX

Hello,
I am facing a different problem today. This could be simple one but, I have wasted 6 hours already to resolve this. Everything working fine as expected except one scenario.

I have a requirement to generate the slide which has two RADAR charts in the same slide side by side. When I write logic to add two charts to the same slide, code is executing fine, but when I open the file it is asking for repair or showing alert and if I select repair or alert ok then it is completely removing all the content from the slide. So, I am seeing empty slide. Do you know why it is happening?

This is very urgent, please help me out asap.
Version is 4.2.0. And PPTX

Code used for adding chart to slide is below:
private void AddPictureToSlide(Bitmap imgChart, MemoryStream workBookStream, SlideEx slide, float slideStartPosition,
float chartWidth, float chartHeight, float x)
{
//Instantiate the ImageEx class
System.Drawing.Image img = (System.Drawing.Image)imgChart;
ImageEx imgx = Presentation.Images.AddImage(img);
OleObjectFrameEx oof = slide.Shapes.AddOleObjectFrame(x, slideStartPosition, chartWidth, chartHeight,
“Excel.Sheet.8”, workBookStream.ToArray());
oof.Image = imgx;
}


-Praveen.

I have posted a question regrading insert two charts in single slide.

Here is the link.

http://www.aspose.com/community/forums/246046/adding-two-excel-charts-to-the-same-slide-in-a-presentation-pptx/showthread.aspx#246046

I have talked to support team online and he said, it will be resolved soon. I have waited and waited, there is no response. I have told the guy it is urgent as we are stuck in demo. Now, it's really matters. You have knowledge and we are using your product and the support is really needed now. But, the question is still idle and no one responded.

Please resond asap as you can. This is going to be very big help to me from Aspose. We await for the reply.

I am working for Office 2007 presentation format.

-Praveen.


This message was posted using Aspose.Live 2 Forum

Dear Praveen,

I have observed the issue specified by you and have been able to reproduce the issue specified by you. It unfortunately seems to be an issue with Aspose.Slides for .NET. An issue with ID 18123 has been created in our issue tracking system for further investigation and resolution. This thread has also been linked with the issue so that you may be automatically notified, once the issue is resolved.

We are sorry for your inconvenience,

Dear Praveen,

I am extremely sorry for your nuisance,

I have been working on your specified issue and been trying to figure out the problem. I have tried different types of charts and all have failed. I evantually came up with a workaround that can serve the purpose. In my suggestion, if you could add the chart as an image in the picture frame then you can add multiple charts on the same slide. For your kind reference, I have shared the code snippet as well.

PresentationEx PresChart = new PresentationEx("D:\\ppt\\TestChart.pptx");

SlideEx Slide = PresChart.Slides[0];

Workbook wbChart = new Workbook();

wbChart.Open("D:\\ppt\\Chart1.xls");

Bitmap imgChart = wbChart.Worksheets[0].Charts[0].ToImage();

//Adding Image to Picture frame

System.Drawing.Image image = (System.Drawing.Image)new Bitmap(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

ImageEx Imgx = PresChart.Images.AddImage(image);

//Calculating picture width and height

int pictureWidth = image.Width/2;

int pictureHeight = image.Height/2;

//Adding picture frame to the slide

Slide.Shapes.AddPictureFrame(ShapeTypeEx.Rectangle, 0, 0,

pictureWidth, pictureHeight,Imgx);

wbChart.Open("D:\\ppt\\Chart2.xls");

imgChart = wbChart.Worksheets[0].Charts[0].ToImage();

//Adding 2nd Image to Picture frame

image = (System.Drawing.Image)new Bitmap(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

Imgx = PresChart.Images.AddImage(image);

//Calculating picture width and height

pictureWidth = image.Width/2;

pictureHeight = image.Height/2;

//Adding picture frame to the slide

Slide.Shapes.AddPictureFrame(ShapeTypeEx.Rectangle, image.Width+10, 0,

pictureWidth, pictureHeight, Imgx);

PresChart.Write("D:\\temp.pptx");

We are greatly sorry for your inconvenience,

Thanks.

Adding as a picture frame is what I have already done for temporary. But, we want it as a chart. Let me know, if there is any solution,

-Praveen.

Dear Praveen,

As I have mentioned earlier that addition of two OLE frames in single slide is creating issue while opening the presentation seems to be an inconsistency in Aspose.Slides for .NET and this issue has been added in our issue tracking system for resolution. As soon as the issue is resolved, I will be happy to share the information with you.

We are sorry for your inconvenience,