Hi there
We are attempting to load an existing powerpoint file which has embedded Excel objects, modify the embedded Excel grid and then resave the Powerpoint. We have been using essentially the same code for a couple of years with 2003 but with 2007/2010 the changes are not saved to the Powerpoint file (if we save the workbook then we do see the changes in there). Here is the code we are using (with the attached sample Powerpoint).
Am I doing something wrong? We are using the latest Slides 2.6.0 relese
Thanks
Andrew
FileInputStream is = new FileInputStream("D:\\VisualCrossing\\templates\\test.pptx");
PresentationEx presentation= new PresentationEx(is);
SlideEx slide=presentation.getSlides().get(0);
ShapeEx shape=null;
for (int i=0;i<slide.getShapes().size();i++) {
if (!(slide.getShapes().get(i) instanceof OleObjectFrameEx)) continue;
shape=slide.getShapes().get(i);
}
if (shape==null) return;
OleObjectFrameEx oleObjectFrame=(OleObjectFrameEx)shape;
ByteArrayInputStream workBookInputStream = new ByteArrayInputStream(oleObjectFrame.getObjectData());
com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook();
workbook.open(workBookInputStream);
Worksheets sheets = workbook.getWorksheets();
sheets.getSheet(0).getCells().getCell(0,0).setValue("MyValue");
ByteArrayOutputStream workBookOutputStream = new ByteArrayOutputStream();
workbook.save(workBookOutputStream);
oleObjectFrame.setObjectData(workBookOutputStream.toByteArray());
FileOutputStream os = new FileOutputStream("D:\\VisualCrossing\\templates\\test_out.pptx");
presentation.write(os);FileInputStream is = new FileInputStream("D:\\VisualCrossing\\templates\\test.pptx");
PresentationEx presentation= new PresentationEx(is);
SlideEx slide=presentation.getSlides().get(0);
ShapeEx shape=null;
for (int i=0;i<slide.getShapes().size();i++) {
if (!(slide.getShapes().get(i) instanceof OleObjectFrameEx)) continue;
shape=slide.getShapes().get(i);
}
if (shape==null) return;
OleObjectFrameEx oleObjectFrame=(OleObjectFrameEx)shape;
ByteArrayInputStream workBookInputStream = new ByteArrayInputStream(oleObjectFrame.getObjectData());
com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook();
workbook.open(workBookInputStream);
Worksheets sheets = workbook.getWorksheets();
sheets.getSheet(0).getCells().getCell(0,0).setValue("MyValue");
ByteArrayOutputStream workBookOutputStream = new ByteArrayOutputStream();
workbook.save(workBookOutputStream);
oleObjectFrame.setObjectData(workBookOutputStream.toByteArray());
FileOutputStream os = new FileOutputStream("D:\\VisualCrossing\\templates\\test_out.pptx");
presentation.write(os);