Hello. I tried to do manipulate a chart with excels chartfunction and export it to powerpoint. I saw the code in this forum and tested it. Here it is:
Presentation pres = new Presentation(MapPath(".") + "\\Chart2.ppt");
OleObjectFrame shape = (OleObjectFrame) pres.Slides[0].Shapes[0];
byte[] xlsData = shape.ObjectData;
//open chart
MemoryStream stream1 = new MemoryStream(xlsData);
Excel excel = new Excel();
excel.Open(stream1);
excel.Worksheets[0].Cells["C3"].PutValue(150);
//Save excel back to the memorystream
MemoryStream stream2 = new MemoryStream();
excel.Save(stream2,FileFormatType.Default);
//Replace chart data in our presentation and save to ppt
shape.ObjectData = stream2.ToArray();
pres.Write(MapPath(".")+ "\\ppt2.ppt");
It didn´t get the expected result because the name of the bars disappered and also the name of the legends, and the cell "C3" did not get the number 150. Dose anyone see if I have done something wrong?
//The_L