Summary: | XmlValueDisconnectedException when merging slides from 2 slideshows | ||
---|---|---|---|
Product: | POI | Reporter: | Georgi Sokolov <joro> |
Component: | HSLF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 3.9-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
URL: | http://projects.liquidsoft.eu/FlexiaJava.zip | ||
Attachments: |
PPTX 2
PPTX 1 |
Description
Georgi Sokolov
2013-01-11 16:08:14 UTC
Created attachment 29846 [details]
PPTX 2
Created attachment 29847 [details]
PPTX 1
This is not the original testing file, I can send the links to the original testing files, but it basically happens with any file
XmlValueDisconnectedException happens when you call importContent on the same sheets multuple times. In the current implementation you can do it only once: layout.importContent(srcLayout); // OK layout.importContent(srcLayout); // fails with XmlValueDisconnectedException the workaround is to track visited sheets and remember them in a set. Below is a modification of your code that passes without exceptions: XMLSlideShow ppt1 = new XMLSlideShow(new FileInputStream("/temp/54407/10steps.pptx")); XSLFSlide[] slides = ppt1.getSlides(); XMLSlideShow ppt_out = new XMLSlideShow(); // track already imported sheets HashSet<XSLFSheet> visited = new HashSet<XSLFSheet>(); for(XSLFSlide srcSlide : slides) { XSLFSlideLayout src_sl = srcSlide.getSlideLayout(); XSLFSlideMaster src_sm = srcSlide.getSlideMaster(); XSLFSlide newSlide = ppt_out.createSlide(); XSLFSlideLayout new_sl = newSlide.getSlideLayout(); if(!visited.contains(new_sl)) { new_sl.importContent(src_sl); visited.add(new_sl); } XSLFSlideMaster new_sm = newSlide.getSlideMaster(); if(!visited.contains(new_sm)) { new_sm.importContent(src_sm); visited.add(new_sm); } newSlide.importContent(srcSlide); } Since because of the file limitations, I have uploaded the original code + the test files here: http://projects.liquidsoft.eu/FlexiaJava.zip Here is my use case: java -jar dist\FlexiaJava.jar out.pptx 10steps.pptx 3 java -jar dist\FlexiaJava.jar out.pptx 10steps.pptx 5 java -jar dist\FlexiaJava.jar out.pptx 10steps.pptx 2 java -jar dist\FlexiaJava.jar out.pptx dash.pptx 3 Strangly the first time importing from the other file works fine(although not producing the correct output). Then we try to add another slide from the second presentation. java -jar dist\FlexiaJava.jar out.pptx dash.pptx 5 And it crashes: Exception in thread "main" org.apache.xmlbeans.impl.values.XmlValueDisconnectedException at org.apache.xmlbeans.impl.values.XmlObjectBase.check_orphaned(XmlObjectBase.java:1213) at org.openxmlformats.schemas.drawingml.x2006.main.impl.CTShapePropertiesImpl.isSetNoFill(Unknown Source) at org.apache.poi.xslf.usermodel.RenderableShape$4.fetch(RenderableShape.java:352) at org.apache.poi.xslf.usermodel.XSLFSimpleShape.fetchShapeProperty(XSLFSimpleShape.java:602) at org.apache.poi.xslf.usermodel.RenderableShape.getFillPaint(RenderableShape.java:364) at org.apache.poi.xslf.usermodel.XSLFSimpleShape.getFillColor(XSLFSimpleShape.java:490) at org.apache.poi.xslf.usermodel.XSLFSimpleShape.copy(XSLFSimpleShape.java:649) at org.apache.poi.xslf.usermodel.XSLFTextShape.copy(XSLFTextShape.java:561) at org.apache.poi.xslf.usermodel.XSLFSheet.importContent(XSLFSheet.java:310) at org.apache.poi.xslf.usermodel.XSLFSlide.importContent(XSLFSlide.java:226) at flexiajava.FlexiaJava.main(FlexiaJava.java:73) I'm currently offering $500(over paypal) for a bugfix on this issue if I'm able to merge 2 presentations properly(no XMLDisconnects), proper master pages and styles. This has to be done today! OK, I will try to find time to look into it. Will give my feedback within 24 hours. Yegor (In reply to comment #5) > I'm currently offering $500(over paypal) for a bugfix on this issue if I'm > able to merge 2 presentations properly(no XMLDisconnects), proper master > pages and styles. This has to be done today! Should be fixed in r1436913 and r1436608. The following problems have been fixed: - image format .wdp was not supported. That resulted in NPE. - image relations under ExtLst element were not imported. importContent silently passed but PowerPoint showed "unreadable content" when opening the result. - cached placeholders were not invalidated after calling importContent. That resulted in XmlValueDisconnectedException - relationships for the diagram shapes were not copied. That resulted in "unreadable content" when opening the result in PowerPoint. All presentations attached in http://projects.liquidsoft.eu/FlexiaJava.zip merge without exceptions and PowerPoint is happy to open the result. Please try with the latest build from trunk. If there are still errors then please attach more test files/cases. Regards, Yegor Latest build from trunk solved this issue for me. Thank you for the timely fix! |