Multiple Relationships in pptx4j
Posted:
Fri Jun 24, 2011 10:11 am
by Jim
One thing I ran into, using pptx4j: when I look in an XML version of my PPTX file, I see several Relationships; looks like a 'master' relationship, plus one for every slide, possibly a couple more.
When I try to access these from the code, I retrieved a Relationships object, but when I dug into it, it just gave me the 'master' ("/_rels/.rels") relationship. I wasn't able to get to the slide relationships. Am I doing something wrong, or is this a hole?
Thanks,
Jim
Re: Multiple Relationships in pptx4j
Posted:
Sat Jun 25, 2011 12:18 am
by jason
You should see whatever relationships are actually specified in the pptx.
Try running your pptx through the PartsList sample: org.docx4j.samples.PartsList
/_rels/.rels should contain target /ppt/presentation.xml;
This MainPresentation part's rels should in turn contain a rel targetting each slide.
- Code: Select all
Part /_rels/.rels
Part /ppt/presentation.xml
Part /ppt/slides/slide1.xml
Re: Multiple Relationships in pptx4j
Posted:
Sat Jun 25, 2011 5:29 am
by Jim
Please point at what I'm misunderstanding. I ran PartsList against my pptx file, below, and received the output at bottom. I searched for _rels, and only got one hit, none for the parts such as /ppt/slides/_rels/slide3.xml.rels. Is there something different about my pptx?
My pptx (the top snippet, in XML format):
Using xml Syntax Highlighting
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<?mso-application progid="PowerPoint.Show"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:padding="512" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/_rels/.rels">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Target="docProps/app.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Id="rId3"/>
<Relationship Target="docProps/core.xml" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Id="rId2"/>
<Relationship Target="ppt/presentation.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Id="rId1"/>
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/ppt/slides/_rels/slide3.xml.rels">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Target="../slideLayouts/slideLayout2.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Id="rId1"/>
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/ppt/slides/_rels/slide1.xml.rels">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Target="../slideLayouts/slideLayout1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Id="rId1"/>
</Relationships>
</pkg:xmlData>
</pkg:part>
...
Parsed in 0.003 seconds, using
GeSHi 1.0.8.4
Output from PartsList:
- Code: Select all
Part /_rels/.rels [org.docx4j.openpackaging.parts.relationships.RelationshipsPart] containing JaxbElement:org.docx4j.relationships.Relationships
Part /docProps/app.xml [org.docx4j.openpackaging.parts.DocPropsExtendedPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties containing JaxbElement:org.docx4j.docProps.extended.Properties
Part /docProps/core.xml [org.docx4j.openpackaging.parts.DocPropsCorePart] http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties containing JaxbElement:org.docx4j.docProps.core.CoreProperties
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/slides/slide7.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout
Part /ppt/media/image4.png [org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
Part /ppt/media/image3.png [org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
Part /ppt/slideMasters/slideMaster1.xml [org.docx4j.openpackaging.parts.PresentationML.SlideMasterPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster containing JaxbElement:org.pptx4j.pml.SldMaster
Part /ppt/theme/theme1.xml [org.docx4j.openpackaging.parts.ThemePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme containing JaxbElement:org.docx4j.dml.Theme
Part /ppt/media/image1.jpeg [org.docx4j.openpackaging.parts.WordprocessingML.ImageJpegPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/slideLayouts/slideLayout1.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout
Part /ppt/media/image3.png [org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image [additional reference]
Part /ppt/media/image2.png [org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
Part /ppt/slideMasters/slideMaster1.xml [org.docx4j.openpackaging.parts.PresentationML.SlideMasterPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster containing JaxbElement:org.pptx4j.pml.SldMaster [additional reference]
Part /ppt/media/image4.png [org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image [additional reference]
Part /ppt/media/image2.png [org.docx4j.openpackaging.parts.WordprocessingML.ImagePngPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image [additional reference]
Part /ppt/viewProps.xml [org.docx4j.openpackaging.parts.PresentationML.ViewPropertiesPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps containing JaxbElement:org.pptx4j.pml.ViewPr
Part /ppt/slides/slide2.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/slides/slide6.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
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/slideLayouts/slideLayout1.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/slideMasters/slideMaster1.xml [org.docx4j.openpackaging.parts.PresentationML.SlideMasterPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster containing JaxbElement:org.pptx4j.pml.SldMaster [additional reference]
Part /ppt/slides/slide5.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/media/image5.jpeg [org.docx4j.openpackaging.parts.WordprocessingML.ImageJpegPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/notesMasters/notesMaster1.xml [org.docx4j.openpackaging.parts.PresentationML.NotesMasterPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster containing JaxbElement:org.pptx4j.pml.NotesMaster
Part /ppt/theme/theme2.xml [org.docx4j.openpackaging.parts.ThemePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme containing JaxbElement:org.docx4j.dml.Theme
Part /ppt/slides/slide4.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/tableStyles.xml [org.docx4j.openpackaging.parts.PresentationML.TableStylesPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles containing JaxbElement:org.docx4j.dml.CTTableStyleList
Part /ppt/slides/slide9.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/slides/slide3.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/slides/slide8.xml [org.docx4j.openpackaging.parts.PresentationML.SlidePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide containing JaxbElement:org.pptx4j.pml.Sld
Part /ppt/slideLayouts/slideLayout2.xml [org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout containing JaxbElement:org.pptx4j.pml.SldLayout [additional reference]
Part /ppt/theme/theme1.xml [org.docx4j.openpackaging.parts.ThemePart] http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme containing JaxbElement:org.docx4j.dml.Theme [additional reference]
Re: Multiple Relationships in pptx4j
Posted:
Sat Jun 25, 2011 10:31 am
by jason
No, your pptx is fine.
Try (current SVN):
- Code: Select all
presentationMLPackage.getMainPresentationPart().getRelationshipsPart()
or with 2.6.0, looking through:
- Code: Select all
presentationMLPackage.getParts().getParts()
(though note that that contains all parts except relationship parts)
Or more generally, see the src for PartsList. The rels parts are implicit in the output indentation; they aren't shown, because they'd clutter up the output for little gain.