public class OdsElements extends Object implements StylesContainer
Contains method for flush and async flush:
| Modifier and Type | Field and Description |
|---|---|
static Map<String,String> |
BASE_NAMESPACE_BY_PREFIX |
static String |
SC_SPLIT_FIX
LO only: freeze cells
|
static String |
SC_SPLIT_NORMAL
LO only: do not freeze cells
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAutoFilter(AutoFilter autoFilter)
Add an AutoFilter to a table
|
void |
addCellStyle(TableCellStyle style,
CellType... types)
Add a cell style for a given data type.
|
TableCellStyle |
addChildCellStyle(TableCellStyle style,
DataStyle dataStyle)
Add a child style that mixes the cell style with a data style to the container
|
boolean |
addContentFontFaceContainerStyle(FontFaceContainerStyle objectStyle)
Add a cell style to the content container and register the font face
|
boolean |
addContentStyle(ObjectStyle objectStyle)
Add an object style (style:style) to content.xml/automatic-styles
|
boolean |
addDataStyle(DataStyle dataStyle)
Create a new data style into styles container.
|
void |
addEvents(ScriptEventListener... events)
Add some events to the document
|
void |
addExtraDir(String fullDirectoryPath)
Add an extra dir.
|
void |
addExtraFile(String fullPath,
String mediaType,
byte[] data)
Add an extra file
|
void |
addExtraObject(String fullDirectoryPath,
String mediaType,
String version)
Add an extra object (eg. a spreadsheet)
|
boolean |
addMasterPageStyle(MasterPageStyle masterPageStyle)
Create a new master page style into styles container.
|
boolean |
addNewDataStyleFromCellStyle(TableCellStyle style)
Add the data style taken from a cell style
|
void |
addObserver(NamedOdsFileWriter o)
The OdsElements is observable by a writer.
|
boolean |
addPageLayoutStyle(PageLayoutStyle pageLayoutStyle)
Add a page layout style
|
boolean |
addPageStyle(PageStyle ps)
Add a page style
|
void |
addPilotTable(PilotTable pilot) |
boolean |
addStylesFontFaceContainerStyle(FontFaceContainerStyle ffcStyle)
Add a cell style to the content container and register the font face
|
boolean |
addStylesStyle(ObjectStyle objectStyle)
Add an object style to styles.xml/automatic-styles
|
Table |
addTableToContent(String name,
int rowCapacity,
int columnCapacity)
Deprecated.
|
boolean |
addTableToContent(Table table)
Add a new table to content.
|
static OdsElements |
create(PositionUtil positionUtil,
XMLUtil xmlUtil,
IntegerRepresentationCache cache,
DataStyles format,
boolean libreOfficeMode,
MetaElement metaElement,
Map<String,String> additionalNamespaceByPrefix) |
void |
createEmptyElements(XMLUtil util,
ZipUTF8Writer writer)
Create empty elements for package.
|
Table |
createTable(String name,
int rowCapacity,
int columnCapacity) |
void |
debugStyles()
Activate style debugging (for flushers)
|
void |
freezeCells(Table table,
int rowCount,
int colCount)
Freeze cells.
|
void |
freezeStyles()
Freeze the styles: adding a new style to the container will generate an IllegalStateException
|
Table |
getTable(int tableIndex)
Return a table from an index
|
Table |
getTable(String name)
Return a table from a name
|
int |
getTableCount() |
List<Table> |
getTables() |
void |
prepareAsync()
Prepare the elements for writing.
|
void |
saveAsync()
Save the elements, the file is already open.
|
void |
setActiveTable(Table table)
Set a new active table
|
void |
setDataStylesMode(Container.Mode mode)
Set the new mode to use for data styles
|
void |
setMasterPageStyleMode(Container.Mode mode)
Set the new mode to use for master page style
|
void |
setObjectStyleMode(Container.Mode mode)
Set the new mode to use for styles in content.xml/automatic-styles, styles.xml/styles and
styles.xml/automatic-styles
|
void |
setPageLayoutStyleMode(Container.Mode mode)
Set the new mode to use for page layout style
|
void |
setPageStyleMode(Container.Mode mode)
Set the new mode to use for page style
|
void |
setViewSetting(String viewId,
String item,
String value)
Set a view setting
|
void |
writeContent(XMLUtil xmlUtil,
ZipUTF8Writer writer)
Write the content element to a writer.
|
void |
writeExtras(XMLUtil xmlUtil,
ZipUTF8Writer writer) |
void |
writeMeta(XMLUtil xmlUtil,
ZipUTF8Writer writer)
Write the meta element to a writer.
|
void |
writeMimeType(XMLUtil xmlUtil,
ZipUTF8Writer writer)
Write the mimetype element to a writer.
|
void |
writeSettings(XMLUtil xmlUtil,
ZipUTF8Writer writer)
Write the settings element to a writer.
|
void |
writeStyles(XMLUtil xmlUtil,
ZipUTF8Writer writer)
Write the styles element to a writer.
|
public static final String SC_SPLIT_NORMAL
public static final String SC_SPLIT_FIX
public static OdsElements create(PositionUtil positionUtil, XMLUtil xmlUtil, IntegerRepresentationCache cache, DataStyles format, boolean libreOfficeMode, MetaElement metaElement, Map<String,String> additionalNamespaceByPrefix)
positionUtil - an util for cell addresses (e.g. "A1")xmlUtil - an XML utilcache - an util for writeformat - the data styleslibreOfficeMode - try to get full compatibility with LO if truemetaElement - meta.xml representationadditionalNamespaceByPrefix - a map: prefix to NSpublic void addObserver(NamedOdsFileWriter o)
o - the file writerpublic void addCellStyle(TableCellStyle style, CellType... types)
style - the styletypes - the typespublic boolean addDataStyle(DataStyle dataStyle)
StylesContaineraddDataStyle in interface StylesContainerdataStyle - the data style to addpublic void setDataStylesMode(Container.Mode mode)
StylesModeSettersetDataStylesMode in interface StylesModeSettermode - the mode (CREATE, UPDATE, CREATE_OR_UPDATE)public boolean addMasterPageStyle(MasterPageStyle masterPageStyle)
StylesContaineraddMasterPageStyle in interface StylesContainermasterPageStyle - the data style to addpublic void setMasterPageStyleMode(Container.Mode mode)
StylesModeSettersetMasterPageStyleMode in interface StylesModeSettermode - the mode (CREATE, UPDATE, CREATE_OR_UPDATE)public boolean addNewDataStyleFromCellStyle(TableCellStyle style)
StylesContaineraddNewDataStyleFromCellStyle in interface StylesContainerstyle - the cell stylepublic void setPageLayoutStyleMode(Container.Mode mode)
StylesModeSettersetPageLayoutStyleMode in interface StylesModeSettermode - the mode (CREATE, UPDATE, CREATE_OR_UPDATE)public boolean addPageLayoutStyle(PageLayoutStyle pageLayoutStyle)
StylesContaineraddPageLayoutStyle in interface StylesContainerpageLayoutStyle - the stylepublic void setPageStyleMode(Container.Mode mode)
StylesModeSettersetPageStyleMode in interface StylesModeSettermode - the mode (CREATE, UPDATE, CREATE_OR_UPDATE)public boolean addPageStyle(PageStyle ps)
StylesContaineraddPageStyle in interface StylesContainerps - the stylepublic void setObjectStyleMode(Container.Mode mode)
StylesModeSettersetObjectStyleMode in interface StylesModeSettermode - the mode (CREATE, UPDATE, CREATE_OR_UPDATE)public boolean addContentStyle(ObjectStyle objectStyle)
StylesContaineraddContentStyle in interface StylesContainerobjectStyle - the stylepublic boolean addStylesStyle(ObjectStyle objectStyle)
StylesContaineraddStylesStyle in interface StylesContainerobjectStyle - the stylepublic TableCellStyle addChildCellStyle(TableCellStyle style, DataStyle dataStyle)
StylesContaineraddChildCellStyle in interface StylesContainerstyle - the cell styledataStyle - the data stylepublic boolean addContentFontFaceContainerStyle(FontFaceContainerStyle objectStyle)
StylesContaineraddContentFontFaceContainerStyle in interface StylesContainerobjectStyle - the cell style or the text stylepublic boolean addStylesFontFaceContainerStyle(FontFaceContainerStyle ffcStyle)
StylesContaineraddStylesFontFaceContainerStyle in interface StylesContainerffcStyle - the cell style or the text stylepublic void createEmptyElements(XMLUtil util, ZipUTF8Writer writer) throws IOException
util - an xml utilwriter - destinationIOException - if the elements were not created.public void debugStyles()
public void freezeStyles()
@Deprecated public Table addTableToContent(String name, int rowCapacity, int columnCapacity) throws IOException
name - name of the tablerowCapacity - estimated rowscolumnCapacity - estimated columnsIOException - if the OdsElements is observed and there is a write exceptionpublic boolean addTableToContent(Table table) throws IOException
table - the tableIOException - if the OdsElements is observed and there is a write exceptionpublic void prepareAsync()
throws IOException
IOException - if the preparation failspublic void saveAsync()
throws IOException
IOException - if the write failspublic void writeContent(XMLUtil xmlUtil, ZipUTF8Writer writer) throws IOException
xmlUtil - the xml utilwriter - the writerIOException - if write failspublic void writeMeta(XMLUtil xmlUtil, ZipUTF8Writer writer) throws IOException
xmlUtil - the xml utilwriter - the writerIOException - if write failspublic void writeSettings(XMLUtil xmlUtil, ZipUTF8Writer writer) throws IOException
xmlUtil - the xml utilwriter - the writerIOException - if write failspublic void writeStyles(XMLUtil xmlUtil, ZipUTF8Writer writer) throws IOException
xmlUtil - the xml utilwriter - the writerIOException - if write failspublic void freezeCells(Table table, int rowCount, int colCount)
table - the table to freezerowCount - the number of rows to freeze (e.g. 1 to freeze the first row)colCount - the number of cols to freeze.public Table getTable(int tableIndex)
tableIndex - the indexpublic Table getTable(String name)
name - the namepublic int getTableCount()
public void setActiveTable(Table table)
table - the tablepublic void setViewSetting(String viewId, String item, String value)
viewId - the id of the viewitem - the item namevalue - the item valuepublic void addAutoFilter(AutoFilter autoFilter)
autoFilter - the filterpublic void addExtraFile(String fullPath, String mediaType, byte[] data)
fullPath - the name of the file in the sequencemediaType - the MIME typedata - the contentpublic void addExtraDir(String fullDirectoryPath)
fullDirectoryPath - the path of the dirpublic void addExtraObject(String fullDirectoryPath, String mediaType, String version)
fullDirectoryPath - the path of the dirmediaType - the type of the objectversion - the versionpublic void writeExtras(XMLUtil xmlUtil, ZipUTF8Writer writer) throws IOException
xmlUtil - the XML util instance.writer - write the extra files to the archiveIOException - if something can"t be writtenpublic void writeMimeType(XMLUtil xmlUtil, ZipUTF8Writer writer) throws IOException
xmlUtil - the xml utilwriter - the writerIOException - if write failspublic void addEvents(ScriptEventListener... events)
events - the events to addpublic void addPilotTable(PilotTable pilot)
Copyright © 2016–2021. All rights reserved.