- Timestamp:
- 09/02/10 09:35:27 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/pptx4j/java/org/pptx4j/samples/CreateHelloWorld.java
r1096 r1198 27 27 import org.docx4j.openpackaging.packages.PresentationMLPackage; 28 28 import org.docx4j.openpackaging.parts.PartName; 29 import org.docx4j.openpackaging.parts.PresentationML.MainPresentationPart; 30 import org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart; 29 31 import org.docx4j.openpackaging.parts.PresentationML.SlidePart; 30 32 import org.pptx4j.pml.Shape; … … 45 47 String outputfilepath = System.getProperty("user.dir") + "/sample-docs/pptx-test.pptx"; 46 48 47 // Create skeletal package 49 // Create skeletal package, including a MainPresentationPart and a SlideLayoutPart 48 50 PresentationMLPackage presentationMLPackage = PresentationMLPackage.createPackage(); 49 51 50 // It contains a first slide; get it .. 51 // TODO - add convenience methods? 52 SlidePart slidePart = (SlidePart)presentationMLPackage.getParts().getParts().get( 52 // Need references to these parts to create a slide 53 MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get( 54 new PartName("/ppt/presentation.xml")); 55 SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get( 56 new PartName("/ppt/slideLayouts/slideLayout1.xml")); 57 58 // OK, now we can create a slide 59 SlidePart slidePart = presentationMLPackage.createSlidePart(pp, layoutPart, 53 60 new PartName("/ppt/slides/slide1.xml")); 54 61 55 62 // Create and add shape 56 63 Shape sample = ((Shape)XmlUtils.unmarshalString(SAMPLE_SHAPE, Context.jcPML) );
Note: See TracChangeset
for help on using the changeset viewer.
