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(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.
(如果颜色基于主题,则根据需要从中继承信息(目前只是颜色)。)
|
protected void |
setColorMap(IndexedColorMap colorMap)
called from
StylesTable when setting theme, used to adjust colors if a custom indexed mapping is defined
(设置主题时从 StylesTable 调用,如果定义了自定义索引映射,则用于调整颜色)
|
void |
writeTo(java.io.OutputStream out)
Write this table out as XML.
(将此表写为 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, toString
public ThemesTable()
public ThemesTable(PackagePart part) throws java.io.IOException
part
- A PackagePart.
(part - 一个 PackagePart。)
java.io.IOException
(java.io.IOException)
public ThemesTable(org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument theme)
theme
- A ThemeDocument.
(主题 - 一个主题文档。)
protected void setColorMap(IndexedColorMap colorMap)
StylesTable
when setting theme, used to adjust colors if a custom indexed mapping is defined
(设置主题时从 StylesTable 调用,如果定义了自定义索引映射,则用于调整颜色)
colorMap
-
(颜色映射 -)
public XSSFColor getThemeColor(int idx)
getThemeColor
in interface
Themes
(界面 Themes 中的 getThemeColor)
idx
- A theme "index"
(idx - 主题“索引”)
public void inheritFromThemeAsRequired(XSSFColor color)
inheritFromThemeAsRequired
in interface
Themes
(接口 Themes 中的 inheritFromThemeAsRequired)
public void writeTo(java.io.OutputStream out) throws java.io.IOException
out
- The stream to write to.
(out - 要写入的流。)
java.io.IOException
- if an error occurs while writing.
(java.io.IOException - 如果写入时发生错误。)
protected void commit() throws java.io.IOException
POIXMLDocumentPart
Sub-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(); OutputStream out = part.getOutputStream(); XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); out.close(); }(将内容保存在底层包部分中。默认实现是空的,这意味着包部分保持不变。子类应覆盖并添加逻辑以将“模型”编组到 Ooxml4J。例如,保存通用 XML 条目的代码可能如下所示: protected void commit() throws IOException { PackagePart part = getPackagePart();输出流输出 = part.getOutputStream(); XmlObject bean = getXmlBean(); //保存内存变化的“模型” bean.save(out, DEFAULT_XML_OPTIONS); out.close(); })
commit
in class
POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committed
(java.io.IOException - 如果无法提交更改,子类可能会抛出 IOException)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.