I added a picture background to a slide (in Powerpoint 2010).
From running the result through PartsList, it is easy to see the image is a rel of the slide:
- Code: Select all
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
Looking then at /ppt/slides/slide1.xml, we see:
Using xml Syntax Highlighting
<p:sld 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:cSld>
<p:bg>
<p:bgPr>
<a:blipFill dpi="0" rotWithShape="1">
<a:blip r:embed="rId2">
<a:lum/>
</a:blip>
<a:srcRect/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</a:blipFill>
<a:effectLst/>
</p:bgPr>
</p:bg>
<p:spTree>
:
Parsed in 0.001 seconds, using
GeSHi 1.0.8.4
So, you need to add the image as a rel to your slide:
1. create a Part for your image (eg ImageJpegPart)
2. add it, using Relationship rel = slide.addTargetPart(imagePart)
3. then set p:bg using getJaxbElement().getCSld().setBg(value). When you construct the background value, you'll need to use the rel id (obtained for rel in step 2 above) for @r:embed