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

Free Support Forum - aspose.com

How to add a chart dynamicaly to a slide

how can i add a chart dynamicaly to a slide using the aspose.


This message was posted using Aspose.Live 2 Forum

Dear nitheesh,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides

You can add a chart as an OLE object into your slide. Below is the code that adds an excel chart inside the presentation.

I have attached the sample excel chart, and the output ppt file generated by the code below. Please open the ppt file and double click the OleObject Changed Image, the chart will appear.

Please also see.

Programmer’s Guide


Object Changed Issue When Adding OleObjectFrame



//Create new presentation

Presentation pres = new Presentation();

//Get the first slide which is added by default

Slide sld = pres.GetSlideByPosition(1);

//Read the excel chart into stream

FileStream fin = new FileStream(@"c:\sampleChart.xls", FileMode.Open, FileAccess.Read);

//Convert the stream into bytes array

byte[] data = new byte[fin.Length];

fin.Read(data, 0, (int)fin.Length);

//Close the stream


//Inserting the excel chart as new OleObjectFrame to a slide

OleObjectFrame oof = sld.Shapes.AddOleObjectFrame(500, 500, 4000, 3000, "Excel.Sheet.8", data);

//Write presentation on disk.