Page 1 of 1

Query about roudtriptest

PostPosted: Fri Jun 17, 2011 5:11 pm
by qhfcrystal
Hi jason.
I encountered some problem when use RoudTripTest.java to test one pptx i got here.
Exception goes with. Any idea?

Code: Select all
com.sun.istack.internal.SAXException2: unable to marshal type "org.docx4j.dml.CTTableStyleList" as an element because it is missing an @XmlRootElement annotation]
   at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)

Re: Query about roudtriptest

PostPosted: Fri Jun 17, 2011 6:35 pm
by qhfcrystal
Besides, the reason I come up with this question is in a pptx i generated, i would like to adopt the other ppt's pattern and masterview.
However, when I parse the sldMaster node, the doc will not be opened.

Then I'm thiking if I could load a slides in and add content, however, I could no loaded those pptx.

Is there any way to meed my need?

Thx.

Code: Select all
MainPresentationPart pp = new MainPresentationPart();
        pp.setJaxbElement(MainPresentationPart.createJaxbPresentationElement() );
        presentationMLPackage.addTargetPart(pp);             
                               
       
       
        // Slide Master part
        SlideMasterPart masterPart = new SlideMasterPart();
        pp.addSlideMasterIdListEntry(masterPart);
        masterPart.setJaxbElement((SldMaster) XmlUtils.unmarshalString(sldMaster4, Context.jcPML));
//        masterPart.setJaxbElement(masterPart.createSldMaster() );
       
        // Slide layout part
        SlideLayoutPart layoutPart = new SlideLayoutPart();
        layoutPart.setJaxbElement( SlideLayoutPart.createSldLayout() );
       
       
        masterPart.addSlideLayoutIdListEntry(layoutPart);
       
        layoutPart.addTargetPart(masterPart);
       
       
        // Theme part
        ThemePart themePart = new ThemePart(new PartName("/ppt/theme/theme1.xml"));
        java.io.InputStream is = org.docx4j.utils.ResourceUtils.getResource(
                                "org/docx4j/openpackaging/parts/PresentationML/theme.xml");
        themePart.unmarshal(is);
       
        // .. add it in 2 places ..
        masterPart.addTargetPart(themePart);
        pp.addTargetPart(themePart);
      
      // OK, now we can create a slide
      SlidePart slidePart = presentationMLPackage.createSlidePart(pp,
            layoutPart, new PartName("/ppt/slides/slide1.xml"));
      SlidePart slidePart2 = presentationMLPackage.createSlidePart(pp,
            layoutPart, new PartName("/ppt/slides/slide2.xml"));

Re: Query about roudtriptest

PostPosted: Sat Jun 18, 2011 10:31 am
by jason
The round trip test doesn't do anything fancy, so the marshal exception on "org.docx4j.dml.CTTableStyleList" is a concern.

Could you please post your pptx or a simplified version of same which exhibits the problem?

Re: Query about roudtriptest

PostPosted: Sat Jun 18, 2011 7:10 pm
by qhfcrystal
Hi jason.
Below is my template of PPTX.
I'm trying to create the master view with code. But I have not got it through.

Re: Query about roudtriptest

PostPosted: Sun Jun 19, 2011 12:54 pm
by jason
Your pptx worked fine for me through org.pptx4j.samples.RoundTripTest (using current svn).