Page 1 of 1

Add two autoshapes to the same slide.

PostPosted: Mon Jun 23, 2014 11:35 pm
by Shani
I tried to add two auto shapes to the same slide in PPT using pptx4j library. I input a text file and try to get the PPT file. It work fine with a one auto shape. But If I going to insert two auto shapes, it shows only last auto shape in the slide and not preview the 1st auto shape.

Code: Select all
<p:sp xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
   <p:nvSpPr>
   <p:cNvPr id="2" name="Rectangle 1"/>
   </p:nvSpPr>
   <p:txBody>
   <a:bodyPr rtlCol="0" anchor="ctr"/>
   <a:lstStyle/>
   <a:p>
   <a:r>
   <a:rPr lang="en-US" dirty="0" smtClean="0">
   <a:solidFill>
   <a:schemeClr val="tx1"/>
   </a:solidFill>
   </a:rPr>
   <a:t>Auto Shape txt 1</a:t>
   </a:r>
   </a:p>
   </p:txBody>
   <p:nvSpPr>
   <p:cNvPr id="2" name="Rectangle 1"/>
   </p:nvSpPr>
   <p:txBody>
   <a:bodyPr rtlCol="0" anchor="ctr"/>
   <a:lstStyle/>
   <a:p>
   <a:r>
   <a:rPr lang="en-US" dirty="0" smtClean="0">
   <a:solidFill>
   <a:schemeClr val="tx1"/>
   </a:solidFill>
   </a:rPr>
   <a:t>Auto Shape txt 2</a:t>
   </a:r>
   </a:p>
   </p:txBody>
   </p:sp>


I saved this part as a text file and gave it as an input to a Java project. The relevant java part is mentioned in the below.

Code: Select all
File file = new File("D:\\PPTtxtInput\\slide1.txt");
   String pptInput = deserializeString(file);
   Shape sample = (Shape) (XmlUtils.unmarshalString(pptInput,
                Context.jcPML));       
                slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().
   add(sample);


Even I input this it doesn't show 1st auto shapes details in the slide. Do you have any idea? Thank you

Re: Add two autoshapes to the same slide.

PostPosted: Tue Jun 24, 2014 10:27 pm
by jason
Further info solicited at your cross post at http://stackoverflow.com/questions/2436 ... ing-pptx4j