https://issues.apache.org/bugzilla/show_bug.cgi?id=54407

Yegor Kozlov <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX
                 OS|                            |All

--- Comment #3 from Yegor Kozlov <[email protected]> ---
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);
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to