public class ThemesTable extends POIXMLDocumentPart implements Themes
| Modifier and Type | Class and Description |
|---|---|
static class |
ThemesTable.ThemeElement |
POIXMLDocumentPart.RelationPart| Constructor and Description |
|---|
ThemesTable()
Create a new, empty ThemesTable
|
ThemesTable(java.io.InputStream stream)
Construct a ThemesTable.
|
ThemesTable(PackagePart part)
Construct a ThemesTable.
|
ThemesTable(org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument theme)
Construct a ThemesTable from an existing ThemeDocument.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
commit()
Save the content in the underlying package part.
|
XSSFColor |
getThemeColor(int idx)
Convert a theme "index" (as used by fonts etc) into a color.
|
void |
inheritFromThemeAsRequired(XSSFColor color)
If the colour is based on a theme, then inherit
information (currently just colours) from it as
required.
|
void |
readFrom(java.io.InputStream is)
Read this themes table from an XML file.
|
protected void |
setColorMap(IndexedColorMap colorMap)
called from
StylesTable when setting theme, used to adjust colors if a custom indexed mapping is defined |
void |
writeTo(java.io.OutputStream out)
Write this table out as XML.
|
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toStringpublic ThemesTable()
public ThemesTable(PackagePart part) throws java.io.IOException
part - A PackagePart.java.io.IOExceptionpublic ThemesTable(java.io.InputStream stream)
throws java.io.IOException
stream - input stream.java.io.IOExceptionpublic ThemesTable(org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument theme)
theme - A ThemeDocument.public void readFrom(java.io.InputStream is)
throws java.io.IOException
is - The input stream containing the XML document.java.io.IOException - if an error occurs while reading.protected void setColorMap(IndexedColorMap colorMap)
StylesTable when setting theme, used to adjust colors if a custom indexed mapping is definedpublic XSSFColor getThemeColor(int idx)
getThemeColor in interface Themesidx - A theme "index"public void inheritFromThemeAsRequired(XSSFColor color)
inheritFromThemeAsRequired in interface Themespublic void writeTo(java.io.OutputStream out)
throws java.io.IOException
out - The stream to write to.java.io.IOException - if an error occurs while writing.protected void commit()
throws java.io.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 POIXMLDocumentPartjava.io.IOException - a subclass may throw an IOException if the changes can't be committedCopyright 2022 The Apache Software Foundation or its licensors, as applicable.