use of org.apache.poi.openxml4j.opc.PackagePart in project poi by apache.
the class XSLFSlideShow method getNodesPart.
/**
* Gets the PackagePart of the notes for the
* given slide, or null if there isn't one.
*/
public PackagePart getNodesPart(CTSlideIdListEntry parentSlide) throws IOException, XmlException {
PackageRelationshipCollection notes;
PackagePart slidePart = getSlidePart(parentSlide);
try {
notes = slidePart.getRelationshipsByType(XSLFRelation.NOTES.getRelation());
} catch (InvalidFormatException e) {
throw new IllegalStateException(e);
}
if (notes.size() == 0) {
// No notes for this slide
return null;
}
if (notes.size() > 1) {
throw new IllegalStateException("Expecting 0 or 1 notes for a slide, but found " + notes.size());
}
try {
return slidePart.getRelatedPart(notes.getRelationship(0));
} catch (InvalidFormatException e) {
throw new IllegalStateException(e);
}
}
use of org.apache.poi.openxml4j.opc.PackagePart in project poi by apache.
the class XSLFTheme method commit.
protected final void commit() throws IOException {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "theme"));
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
getXmlObject().save(out, xmlOptions);
out.close();
}
use of org.apache.poi.openxml4j.opc.PackagePart in project poi by apache.
the class XSSFPivotCacheDefinition method commit.
@Beta
@Override
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
//Sets the pivotCacheDefinition tag
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotCacheDefinition.type.getName().getNamespaceURI(), "pivotCacheDefinition"));
ctPivotCacheDefinition.save(out, xmlOptions);
out.close();
}
use of org.apache.poi.openxml4j.opc.PackagePart in project poi by apache.
the class XSSFPivotTable method commit.
@Beta
@Override
protected void commit() throws IOException {
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
//Sets the pivotTableDefinition tag
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotTableDefinition.type.getName().getNamespaceURI(), "pivotTableDefinition"));
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
pivotTableDefinition.save(out, xmlOptions);
out.close();
}
use of org.apache.poi.openxml4j.opc.PackagePart in project poi by apache.
the class XSSFVMLDrawing method commit.
@Override
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
write(out);
out.close();
}
Aggregations