Summary: | Embed Excel / Ole objects into powerpoint | ||
---|---|---|---|
Product: | POI | Reporter: | Andreas Beeker <kiwiwings> |
Component: | SL Common | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | shas.ec92 |
Priority: | P2 | ||
Version: | 4.0.x-dev | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Initial patch |
Description
Andreas Beeker
2017-11-21 23:43:14 UTC
I have tried adding an excel(.xslx) spreadsheet to a powerpoint(.pptx). But so far I havent been unable to do it. I tried recreating the class that you created[EmbedXSSFinXSLF.java] but the line that retrieves the ObjectData from the oleShape[ XSLFObjectData oleData = oleShape.getObjectData();] is throwing a null pointer exception. below is the error: Exception in thread "main" java.lang.NullPointerException at org.apache.poi.xslf.usermodel.XSLFObjectShape.getObjectData(XSLFObjectShape.java:109) at poi.Main.main(Main.java:58) I guess my question would be, is there currently a way to embed a excel spreadsheet(.xslx) into a powerpoint(.pptx)? if not, is there a way to do it using the old .ppt and .xsl formats? (In reply to Andreas Beeker from comment #0) > Created attachment 35543 [details] > Initial patch > > There's been some work done to embed Excel into Powerpoint slides (HSLF) > [1], but the XSLF part is missing. > > This ticket is used to document the progress - eventually provide the > implementation via SL Common. > > The patch shows how to embed XSSF into XSLF. > Additionally it provides a filename generation method to check for existing > media/embedding entries and to create new entries, potentially filling up > already deleted indexes. > > The work is done as response to [2] > > > [1] #55579 and https://stackoverflow.com/questions/2849102 > [2] https://stackoverflow.com/questions/46987387 Which poi version did you use? Did you build the latest poi code from into your own jars - Andreas' change has not been released yet but will appear in v4.0.0 when it is released. https://github.com/plutext/docx4j/blob/master/src/samples/pptx4j/org/pptx4j/samples/EditEmbeddedCharts.java is a sample that might be worth looking at (uses the docx4j libs as opposed to poi libs) Hi, PJ Fanning Thanks for the reply. I did use the Andreas' latest snapshot of the code. I compiled it from Andreas mirror poi project in github, which include the classes that were necessary to build the EmbedXSSFinXSLF.java. I have never used docx4j before, ill look into it. Hopefully it gives me an idea on how to do it on poi or at least use docx4j to insert the excel table into the powerpoint slide. Thanks for the help. Hi Kem, the embedding test class is at [1], but first of all, when you talk about embedding, do you simply want to attach any file in form of a packager object to the slide (then I open the ticket again and see if I can fix the problem) or do you want to show the contents of the Excel (then I'd ask you about opening a new bugzilla entry)? Andi [1] https://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/sl/TestOleShape.java?view=markup Hi, Andi Thanks for the help, it worked. It seems that Office 2007 doesn't know how to properly handle the outputted file by Office 2016 does seem to know. I also tried the latest version of LibreOffice and it also works there. I added the code [1] the I used to my Git-Hub repository in case someone is looking to do the same thing that I wanted to do. Again thanks for all you help. [1] https://github.com/Rasgris/TestPoi/blob/master/EmbedXSSFintoXSLF |