public class XWPFTheme extends POIXMLDocumentPart
POIXMLDocumentPart.RelationPart| Constructor and Description |
|---|
XWPFTheme()
Construct XWPFStyles from scratch for a new document.
|
XWPFTheme(PackagePart part)
Construct XWPFStyles from a package part
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
commit()
Save the content in the underlying package part.
|
org.openxmlformats.schemas.drawingml.x2006.main.CTColor |
getCTColor(String name)
Get a color from the theme's color scheme by name
|
String |
getMajorFont() |
String |
getMinorFont() |
String |
getName() |
void |
importTheme(XSLFTheme theme) |
protected void |
onDocumentRead()
Read document
|
void |
setName(String name)
Set name of this theme
|
void |
setTheme(org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeStyleSheet theme) |
_invokeOnDocumentRead, addRelation, createHyperlink, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getReferenceRelationship, getReferenceRelationships, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeReferenceRelationship, removeRelation, removeRelation, removeRelation, setCommitted, toStringpublic XWPFTheme(PackagePart part)
part - the package part holding the data of the stylespublic XWPFTheme()
public void importTheme(XSLFTheme theme)
public String getName()
public void setName(String name)
name - name of this theme@Internal public org.openxmlformats.schemas.drawingml.x2006.main.CTColor getCTColor(String name)
null if not foundpublic String getMajorFont()
public String getMinorFont()
protected void onDocumentRead()
throws IOException
onDocumentRead in class POIXMLDocumentPartIOException - a subclass may throw an IOException when a document is readprotected void commit()
throws IOException
POIXMLDocumentPartSub-classes should override and add logic to marshal the "model" into Ooxml4J.
For example, the code saving a generic XML entry may look as follows:
protected void commit() throws IOException {
PackagePart part = getPackagePart();
try (OutputStream out = part.getOutputStream()) {
XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
}
}
commit in class POIXMLDocumentPartIOException - a subclass may throw an IOException if the changes can't be committedpublic void setTheme(org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeStyleSheet theme)