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

Free Support Forum - aspose.com

Update embedded spreadsheet with XLS stream

HI, I am evaluating the solution and read many forums within ASPOSE but does not seem to find the interface that allow you to do update of the embedded spreadsheet in slide with another excel 2007 spreadsheet. The only example\capability I seeing is doing updates by cell for the embedded spreadsheet. Can you stand correct? I have slide that have embedded a spreadsheet object and I like to use Java to update the embedded spreadsheet with an excel file stream. Thanks

Hi Jeremy,

I have observed the requirement shared by you and like to share that you can change the Ole frame excel sheet using Aspose.Slides and Aspose.Cells together. However, it is to be noted that if Ole frame is added with xls spread sheet the changed spread sheet must be of xls format. If the ole frame has xlsx spread sheet then the changed spread sheet must be of xlsx format. Please try using the following sample code on your end to serve the purpose.

public static void ChangeOleData()
{
//Loading presentation with Ole frame
Presentation pres=new Presentation (“d:\Aspose Data\TestExcel.pptx”);

//Accessing slide with Ole frame
ISlide slide = pres.getSlides().get_Item(0);

IOleObjectFrame ole = null ;

IShape shape=null;

//Traversing all shapes for Ole frame
for (int i=0;i<slide.getShapes().size();i++)
{
shape=slide.getShapes().get_Item(i);
if (shape instanceof IOleObjectFrame)
{
ole = (IOleObjectFrame)shape;
}
}

if (ole!=null)
{
try {
//Reading object data in Workbook
Workbook Wb;
Wb = new Workbook(“D:\Aspose Data\TestSheet.xlsx”);

com.aspose.cells.OoxmlSaveOptions so1 = new com.aspose.cells.OoxmlSaveOptions(com.aspose.cells.SaveFormat.XLSX);
ByteArrayOutputStream msout=new ByteArrayOutputStream();

//Saving modified excel sheet
Wb.save(msout, so1);

//Changing Ole frame object data
ole.setObjectData(msout.toByteArray());
} catch (Exception ex) {
Logger.getLogger(NewAPi.class.getName()).log(Level.SEVERE, null, ex);
}

}

pres.save(“D:\Aspose Data\OleEmbed.pptx”, SaveFormat.Pptx);

}

Please share, if I may help you further in this regard.

Many Thanks,

Thank you Mudassir, Its to good to hear that you can interface Slide and Cells.



So you need both Aspose.Sldies and Aspose.Cells license? If I want to apply the same for msft word document. Do I need Aspose.words? Would you share the similar code for word?



Can you also confirm that if there are image embed in the updated spreadsheet that this workflow will be supported both in slide and word?

I tested the code using the Trial version but looks like the PPT did not get reflecting pointed slide. I am not sure if this is by product of the trial license. what it got display was the Trial key sheet embed in the slide updated.



Will the paid version eliminate this? Because I can not test the quality of the embedded update with this trial key. When I switch the OLE embed sheet to first sheet the PPT does reelect my updated spreadsheet but the frame size has changed (see attached)!



More important I want to make sure that the XLS slide update works appropriate sheet selection. Please also confirm if you have multiple sheet to update multiple slide that this will not post a challenge.



Thank you





Hi Jeremy,

I like to share that you can test the sample code using 30 days trial license on your end. In order to embed MS Word document as Ole frame inside slide. Please visit this documentation link to see how to save the Word document as stream and that you can update for Ole frame.

Yes, once you will use the license the watermark will be removed. Can you please elaborate your following requirement as well.

More important I want to make sure that the XLS slide update works appropriate sheet selection. Please also confirm if you have multiple sheet to update multiple slide that this will not post a challenge.
Please share, if I may help you further in this regard.

Many Thanks,

Thanks for response Mudassir, My question was for you to confirm where if I have multiple OLE spreadsheet in single slide within a PPT will it be supported.

Is there a spreadsheet to word conversion function with ASPOSE? Can you provide any sample?

Hi Jeremy,


I like to share that you can have any number of Ole frames in your slides. The ole frames are shapes and you can have as many as you like on slides. Secondly, for converting spread sheet to word doc support, I request you to please consult Aspose.Cells forum in this regard for further assistance.

Many Thanks,

My project team just purchase the license and I am integrating it. I notice the XLS frame still not reflect the OLE object within PPT slide until I double click on the OLE object within PPT. Please see below. I am attaching the source code here as well.



2nd Question; If have use both cell\slide and word, do I need to setLicense individually for the same Aspose.Total.Java.lic?



Thanks

Hi Jeremy,


I have observed your questions. In response to your first question, I like to share that it is not an issue with Aspose.Slides but a limitation on Ole engine end that generates the presentation with Ole frames disabled by default. Please visit this documentation link for your kind reference in this regard. There are two options to cater this limitations. First is that you may try using third party Vb Scripts Addons in your presentation that enable the Ole frames whenever the presentation is loaded in PowerPoint. Please visit this documentation link for your kind reference. You can surf over the internet to find a suitable Addon on your end that will serve the purpose for you.

Second option is that you generate the image of excel or word file that is to be displayed in Ole frame by using the respective APIs for excel or Word file management. Then set the image of Ole frame with generated image. This way the Ole frame wlll depict the actual Ole data image even in disabled form. Please remember, that you need to change the image whenever you will modify the ole data programitcally. Please visit this documentation link for your kind reference.


In response to your second question, I like to share that you need to call the licensee of every product separately in your application.


Many Thanks,

Hi Mudassir,



Thanks for sharing the links. I tried to follow the instruction but gotten the error below. Can you please advice?

I think I was able to get the ppt macro incorporated in PowerPoint. The new issue just uncover now is to use powerpoint with macro embedded. I follow the direction you provided in earlier thread of using http://www.aspose.com/docs/display/slidesjava/Updating+OLE+objects+automatically+using+MS+PowerPoint+Add+In.



But while the pptx format now is changed to pptm (enable macro). I can save and close with that extension, but when I feed this new file to ASPOSE.slide to replace my previous .pptx file, I get a pptm file being corrupted when I opened. Are there any suggestion.



My end goal is have the embedded OLE object automatically show up (not static image) and that there is least amount of user-input required



Please see below for the error on opening the pptm file.

Hi Jeremy,


I have observed the requirements shared by you and request you to please share the source PPTM file with embedded ole object that you are trying to load using Aspose.Slides and getting issue. I will investigate the issue further on my end to help you out.

Many Thanks,

Please find attached two pptm files. Please remove.txt to back extension .pptm.



The template file is ppt_template. The corrupted file after ran through with ASPOSE.slide library is PPT_ASPOSE_Changed.pptm.



In my event log4j working with pptx has same steps that execute successful as ppt file.

Hi Jeremy,


I have observed the presentation files shared by you. It seems you are probably trying to save the presentations with macros (PPTM) to PPTX and macros still there. Please try using the following sample code on your end to serve the purpose and share with us if there is any issue incurring on your end.

Presentation pres=new Presentation (path+“ppt_template.pptm”);
pres.save(path+“pt_template2.pptm”, SaveFormat.Pptm);

Many Thanks,

HI Mudassir,



this help. Thank you always.



I have follow the instruction (http://www.aspose.com/docs/display/slidesjava/Updating+OLE+objects+automatically+using+MS+PowerPoint+Add+In) you provided earlier about embedding the add-on http://skp.mvps.org/autoevents.htm and I have created the macro embedded. But I am getting the below error. Can you please assists?



thanks,



-jeremy

Hi Jeremy,


I have observed the image shared by you. I like to share that the AutoEvent add in shared in documentation is for reference or example purpose for our customers. The shared Addin is workable till Office 2007. Unfortunately, I may not be able to help you with third party Addins support. I suggest you to please surf over the internet to find some Addins that is workable with latest PowerPoint version. The third party Addins may be available for free or on charge.

Many Thanks,