Part /ppt/presentation.xml [org.docx4j.openpackaging.parts.PresentationML.MainPresentationPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument containing JaxbElement:org.pptx4j.pml.Presentation
Part /ppt/presProps.xml [org.docx4j.openpackaging.parts.PresentationML.PresentationPropertiesPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps containing JaxbElement:org.pptx4j.pml.PresentationPr
Part /ppt/slides/slide1.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/media/image1.jpg [org.docx4j.openpackaging.parts.WordprocessingML.ImageJpegPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
private static String BACKGROUND="<p:bg><p:bgPr><a:blipFill dpi=\"0\" rotWithShape=\"1\"><a:blip r:embed=\"${rID}\" cstate=\"print\"><a:lum/></a:blip><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>";
MainPresentationPart pp = (MainPresentationPart) presentationMLPackage
.getParts().getParts()
.get(new PartName("/ppt/presentation.xml"));
SlideLayoutPart layoutPart = (SlideLayoutPart) presentationMLPackage
.getParts().getParts()
.get(new PartName("/ppt/slideLayouts/slideLayout1.xml"));
// Create slide page titre
SlidePart slidePart = presentationMLPackage.createSlidePart(pp,
layoutPart, new PartName("/ppt/slides/slide4.xml"));
//background
File file = new File(
"C:/Documents and Settings/guenetMO/Desktop/RapportTest/background.jpg");
BinaryPartAbstractImage imagePartBG = BinaryPartAbstractImage
.createImagePart(presentationMLPackage, slidePart, file);
Relationship rel = slidePart.addTargetPart(imagePartBG);
java.util.HashMap<String, String> mappingsBG = new java.util.HashMap<String, String>();
mappingsBG.put("rID", rel.getId());
Object oBG = org.docx4j.XmlUtils.unmarshallFromTemplate(BACKGROUND,
mappingsBG, Context.jcPML, Pic.class);
slidePart.getJaxbElement().getCSld().setBg((CTBackground) oBG);
private static String BACKGROUND="<p:bg 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:bgPr><a:blipFill dpi=\"0\" rotWithShape=\"1\"><a:blip r:embed=\"${rID}\" cstate=\"print\"><a:lum/></a:blip><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>";
MainPresentationPart pp = (MainPresentationPart) presentationMLPackage
.getParts().getParts()
.get(new PartName("/ppt/presentation.xml"));
SlideLayoutPart layoutPart = (SlideLayoutPart) presentationMLPackage
.getParts().getParts()
.get(new PartName("/ppt/slideLayouts/slideLayout1.xml"));
// Create slide page titre
SlidePart slidePart = presentationMLPackage.createSlidePart(pp,
layoutPart, new PartName("/ppt/slides/slide4.xml"));
//background
File file = new File(
"C:/Documents and Settings/guenetMO/Desktop/RapportTest/background.jpg");
BinaryPartAbstractImage imagePartBG = BinaryPartAbstractImage
.createImagePart(presentationMLPackage, slidePart, file);
Relationship rel = slidePart.addTargetPart(imagePartBG);
java.util.HashMap<String, String> mappingsBG = new java.util.HashMap<String, String>();
mappingsBG.put("rID", rel.getId());
Object oBG = org.docx4j.XmlUtils.unmarshallFromTemplate(BACKGROUND,
mappingsBG, Context.jcPML, CTBackground.class);
slidePart.getJaxbElement().getCSld().setBg((CTBackground) oBG);
Users browsing this forum: No registered users and 67 guests