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

Free Support Forum - aspose.com

Unable to save modified embedded Excel back to Powerpoint

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);

Hi Andrew,

I have worked with the presentation file shared by you and have been able to observe that when the output presentation is generated, the ole frame get un-editable and this is cause of issue. I have tested by re-saving your presentation in PowerPoint 2007 and accessing it using Aspose.Slides for Java 2.3.0. The things worked for me. An issue with ID 29533 has been created in our issue tracking system to further investigate and resolve the issue. 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,

Mudassir

Thanks for your email. I don't see the download link to 2.3.0, only 2.4.0 and above. Can you tell me where I can access version 2.3.0?

I did try to version 2.4.0 and it threw the exception that reported in the following thread:

<a href="https://forum.aspose.com/t/86383</a></font></u></p><p>Will i see the same problem in 2.3.0?</p><p>Regards</p><p>Andrew</p>

Hi Andrew,

Please proceed to this link for Aspose.Slides for Java 2.3.0. Secondly, I would not recommend you to use the mentioned version as there may or may not be some other issue that you can encounter using the said version. Like, when I tested your presentation using Aspose.Slides for Java 2.3.0, it gave me error. I then opened the presentation in PowerPoint 2007 and re-saved it and then accessed that successfully. I was able to edit the sheet data and also able to access that in generated presentation as well.

Thanks and Regards,

Thanks Mudassir

Just to make sure I'm understanding - you are saying there isn't a release where I can achieve this functionality right now (that would recommend)?

Given that we have already delayed the release because of the previous issue, another month long delay due to this new issue is going to be very problematic for my client. Do you know how long this will take to fix?

Thanks

Andrew

Hi Andrew,

The reason for which I used the words "I may not recommend" was due to presentation access issue using Aspose.Slides for Java 2.3.0 for your presentation. However, when I re-saved the presentation in PowerPoint 2007, I was able to perform the operation successfully. You may use this version but just to be on safe side, I said not recommended as I am unaware of the operations you may be applying on presentation and there can be a situation where Aspose.Slides for Java 2.3.0 may have some other issue with your operations. But this is something that is only observable after using the mentioned version. For your kind reference, I have also shared the copy of your source presentation saved in PowerPoint 2007 and it worked fine.

Thanks and Regards,

The issues you have found earlier (filed as 29533) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.