Represents an entry of a OOXML namespace.
Each POIXMLDocumentPart keeps a reference to the underlying a {@link org.apache.poi.openxml4j.opc.PackagePart}.
@author Yegor Kozlov
Counter that provides the amount of incoming relations from other parts
to this part.
Construct POIXMLDocumentPart representing a "core document" namespace part.
Creates new POIXMLDocumentPart - called by client code to create new parts from scratch.
@see #CreateRelationship(POIXMLRelation, POIXMLFactory, int, bool)
Creates an POIXMLDocumentPart representing the given namespace part and relationship.
Called by {@link #read(POIXMLFactory, java.util.Map)} when Reading in an exisiting file.
@param part - The namespace part that holds xml data represenring this sheet.
@param rel - the relationship of the given namespace part
@see #read(POIXMLFactory, java.util.Map)
Creates an POIXMLDocumentPart representing the given namespace part, relationship and parent
Called by {@link #read(POIXMLFactory, java.util.Map)} when Reading in an exisiting file.
@param parent - Parent part
@param part - The namespace part that holds xml data represenring this sheet.
@param rel - the relationship of the given namespace part
@see #read(POIXMLFactory, java.util.Map)
When you open something like a theme, call this to
re-base the XML Document onto the core child of the
current core document
Provides access to the underlying PackagePart
@return the underlying PackagePart
Provides access to the PackageRelationship that identifies this POIXMLDocumentPart
@return the PackageRelationship that identifies this POIXMLDocumentPart
Returns the list of child relations for this POIXMLDocumentPart
@return child relations
Returns the target {@link POIXMLDocumentPart}, where a
{@link PackageRelationship} is set from the {@link PackagePart} of this
{@link POIXMLDocumentPart} to the {@link PackagePart} of the target
{@link POIXMLDocumentPart} with a {@link PackageRelationship#GetId()}
matching the given parameter value.
@param id
The relation id to look for
@return the target part of the relation, or null, if none exists
Returns the {@link PackageRelationship#GetId()} of the
{@link PackageRelationship}, that sources from the {@link PackagePart} of
this {@link POIXMLDocumentPart} to the {@link PackagePart} of the given
parameter value.
@param part
The {@link POIXMLDocumentPart} for which the according
relation-id shall be found.
@return The value of the {@link PackageRelationship#GetId()} or null, if
parts are not related.
Add a new child POIXMLDocumentPart
@param part the child to add
Remove the relation to the specified part in this namespace and remove the
part, if it is no longer needed.
Remove the relation to the specified part in this namespace and remove the
part, if it is no longer needed and flag is set to true.
@param part
The related part, to which the relation shall be Removed.
@param RemoveUnusedParts
true, if the part shall be Removed from the namespace if not
needed any longer.
Returns the parent POIXMLDocumentPart. All parts except root have not-null parent.
@return the parent POIXMLDocumentPart or null
for the root element.
Save the content in the underlying namespace part.
Default implementation is empty meaning that the namespace part is left unmodified.
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() {
PackagePart part = GetPackagePart();
Stream out = part.GetStream();
XmlObject bean = GetXmlBean(); //the "model" which holds Changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
out.close();
}
Save Changes in the underlying OOXML namespace.
Recursively fires {@link #commit()} for each namespace part
@param alreadySaved context set Containing already visited nodes
Create a new child POIXMLDocumentPart
@param descriptor the part descriptor
@param factory the factory that will create an instance of the requested relation
@return the Created child POIXMLDocumentPart
Create a new child POIXMLDocumentPart
@param descriptor the part descriptor
@param factory the factory that will create an instance of the requested relation
@param idx part number
@param noRelation if true, then no relationship is Added.
@return the Created child POIXMLDocumentPart
Iterate through the underlying PackagePart and create child POIXMLFactory instances
using the specified factory
@param factory the factory object that Creates POIXMLFactory instances
@param context context map Containing already visited noted keyed by tarGetURI
Get the PackagePart that is the target of a relationship.
@param rel The relationship
@return The target part
@throws InvalidFormatException
Fired when a new namespace part is Created
Fired when a namespace part is read
Fired when a namespace part is about to be Removed from the namespace
The OPC Package
The properties of the OPC namespace, opened as needed
Wrapper to open a namespace, returning an IOException
in the event of a problem.
Works around shortcomings in java's this() constructor calls
Retrieves all the PackageParts which are defined as
relationships of the base document with the
specified content type.
Checks that the supplied Stream (which MUST
support mark and reSet, or be a PushbackStream)
has a OOXML (zip) header at the start of it.
If your Stream does not support mark / reSet,
then wrap it in a PushBackStream, then be
sure to always use that, and not the original!
@param inp An Stream which supports either mark/reSet, or is a PushbackStream
Get the document properties. This gives you access to the
core ooxml properties, and the extended ooxml properties.
Get the document's embedded files.
Write out this document to an Outputstream.
@param stream - the java Stream you wish to write the file to
@exception IOException if anything can't be written.
Defines a factory API that enables sub-classes to create instances of POIXMLDocumentPart
@author Yegor Kozlov
Create a POIXMLDocumentPart from existing namespace part and relation. This method is called
from {@link POIXMLDocument#load(POIXMLFactory)} when parsing a document
@param parent parent part
@param rel the namespace part relationship
@param part the PackagePart representing the Created instance
@return A new instance of a POIXMLDocumentPart.
Create a new POIXMLDocumentPart using the supplied descriptor. This method is used when Adding new parts
to a document, for example, when Adding a sheet to a workbook, slide to a presentation, etc.
@param descriptor describes the object to create
@return A new instance of a POIXMLDocumentPart.
The core document properties
Extended document properties
Custom document properties
Each custom property element Contains an fmtid attribute
with the same GUID value ({D5CDD505-2E9C-101B-9397-08002B2CF9AE}).
Add a new property
@param name the property name
@throws IllegalArgumentException if a property with this name already exists
Add a new string property
@throws IllegalArgumentException if a property with this name already exists
Add a new double property
@throws IllegalArgumentException if a property with this name already exists
Add a new integer property
@throws IllegalArgumentException if a property with this name already exists
Add a new bool property
@throws IllegalArgumentException if a property with this name already exists
Generate next id that uniquely relates a custom property
@return next property id starting with 2
Check if a property with this name already exists in the collection of custom properties
@param name the name to check
@return whether a property with the given name exists in the custom properties
Wrapper around the two different kinds of OOXML properties
a document can have
Commit Changes to the underlying OPC namespace
Returns the core document properties
Returns the extended document properties
Returns the custom document properties
A {@link POITextExtractor} for returning the textual
content of the OOXML file properties, eg author
and title.
The POIXMLDocument that's open
Creates a new text extractor for the given document
Returns the core document properties
Returns the extended document properties
Returns the custom document properties
Returns opened document
Returns the opened OPCPackage that Contains the document
Returns an OOXML properties text extractor for the
document properties metadata, such as title and author.
Creates a new POIXMLPropertiesTextExtractor for the
given open document.
Creates a new POIXMLPropertiesTextExtractor, for the
same file that another TextExtractor is already
working on.
Returns the core document properties, eg author
Returns the extended document properties, eg
application
Returns the custom document properties, if
there are any
Represents a descriptor of a OOXML relation.
@author Yegor Kozlov
Describes the content stored in a part.
The kind of connection between a source part and a target part in a namespace.
The path component of a pack URI.
Defines what object is used to construct instances of this relationship
Instantiates a POIXMLRelation.
@param type content type
@param rel relationship
@param defaultName default item name
@param cls defines what object is used to construct instances of this relationship
Instantiates a POIXMLRelation.
@param type content type
@param rel relationship
@param defaultName default item name
Returns the filename for the nth one of these,
e.g. /xl/comments4.xml
Return the content type. Content types define a media type, a subtype, and an
optional set of parameters, as defined in RFC 2616.
@return the content type
Return the relationship, the kind of connection between a source part and a target part in a namespace.
Relationships make the connections between parts directly discoverable without looking at the content
in the parts, and without altering the parts themselves.
@return the relationship
Return the default part name. Part names are used to refer to a part in the context of a
namespace, typically as part of a URI.
@return the default part name
Return type of the obejct used to construct instances of this relationship
@return the class of the object used to construct instances of this relation
@return maximum 1-base index of column that were rendered, zero if none
Creates COLGROUP element with width specified for all columns. (Except
first if {@link #isOutputRowNumbers()}==true)
是否输出列头
是否输出隐藏的列
是否输出隐藏的行
是否输出文本前的空格
是否输出行号
在跨列的单元格使用DIV标记
Creates a map (i.e. two-dimensional array) filled with ranges. Allow fast
retrieving {@link CellRangeAddress} of any cell, if cell is contained in
range.
@see #getMergedRange(CellRangeAddress[][], int, int)
See here for Xio explanation and details
@param mergedRanges
map of sheet merged ranges built with
{@link #buildMergedRangesMap(HSSFSheet)}
@return {@link CellRangeAddress} from map if cell with specified row and
column numbers contained in found range, null otherwise
A deprecated indexing scheme for colours that is still required for some records, and for backwards
compatibility with OLE2 formats.
Each element corresponds to a color index (zero-based). When using the default indexed color palette,
the values are not written out, but instead are implied. When the color palette has been modified from default,
then the entire color palette is used.
@author Yegor Kozlov
Returns index of this color
@return index of this color
Only Text and Formulas are imported. Pictures, Drawing, Styles etc. are all ignored.
Only Text, Comments and Formulas are imported. Pictures, Drawing, Styles etc. are all ignored.
Everything is imported - this is the same as NONE.
Factory for creating the appropriate kind of Workbook
(be it HSSFWorkbook or XSSFWorkbook), from the given input
Creates an HSSFWorkbook from the given POIFSFileSystem
Creates an HSSFWorkbook from the given NPOIFSFileSystem
Creates an XSSFWorkbook from the given OOXML Package
Creates the appropriate HSSFWorkbook / XSSFWorkbook from
the given InputStream. The Stream is wraped inside a PushbackInputStream.
Input Stream of .xls or .xlsx file
IWorkbook depending on the input HSSFWorkbook or XSSFWorkbook is returned.
Creates the appropriate HSSFWorkbook / XSSFWorkbook from
the given File, which must exist and be readable.
Creates the appropriate HSSFWorkbook / XSSFWorkbook from
the given InputStream. The Stream is wraped inside a PushbackInputStream.
Input Stream of .xls or .xlsx file
Customize the elements that are processed on the next import
IWorkbook depending on the input HSSFWorkbook or XSSFWorkbook is returned.
Creates a specific FormulaEvaluator for the given workbook.
Sets the import option when opening the next workbook.
Works only for XSSF. For HSSF workbooks this option is ignored.
Customize the elements that are processed on the next import
24.08.2009 @author Stefan Stern
List of segments of available identifiers
@param lowerbound the lower limit of the id-range to manage. Must be greater than or equal to {@link #MIN_ID}.
@param upperbound the upper limit of the id-range to manage. Must be less then or equal {@link #MAX_ID}.
@return a new identifier.
@throws IllegalStateException if no more identifiers are available, then an Exception is raised.
@param id
the identifier to release. Must be greater than or equal to
{@link #lowerbound} and must be less than or equal to {@link #upperbound}
@return true, if the identifier was reserved and has been successfully
released, false, if the identifier was not reserved.
Provides handy methods to work with OOXML namespaces
@author Yegor Kozlov
Clone the specified namespace.
@param pkg the namespace to clone
@param file the destination file
@return the Cloned namespace
Creates an empty file in the default temporary-file directory,
Recursively copy namespace parts to the destination namespace
Copy core namespace properties
@param src source properties
@param tgt target properties
@author Yegor Kozlov
Helper class to extract text from an OOXML Excel file
Should sheet names be included? Default is true
Should we return the formula itself, and not
the result it produces? Default is false
Should cell comments be included? Default is true
Should headers and footers be included? Default is true
Retreives the text contents of the file
Maps an XLSX to an XML according to one of the mapping defined.
The output XML Schema must respect this limitations:
- all mandatory elements and attributes must be mapped (enable validation to check this)
- no <any> in complex type/element declaration
- no <anyAttribute> attributes declaration
- no recursive structures: recursive structures can't be nested more than one level
- no abstract elements: abstract complex types can be declared but must not be used in elements.
- no mixed content: an element can't contain simple text and child element(s) together
- no <substitutionGroup> in complex type/element declaration
Creates a new exporter and Sets the mapping to be used when generating the XML output document
@param map the mapping rule to be used
Exports the data in an XML stream
@param os OutputStream in which will contain the output XML
@param validate if true, validates the XML againts the XML Schema
@throws SAXException
@throws TransformerException
@throws ParserConfigurationException
Exports the data in an XML stream
@param os OutputStream in which will contain the output XML
@param encoding the output charset encoding
@param validate if true, validates the XML againts the XML Schema
@throws SAXException
@throws ParserConfigurationException
@throws TransformerException
@throws InvalidFormatException
Validate the generated XML against the XML Schema associated with the XSSFMap
@param xml the XML to validate
@return
Compares two xpaths to define an ordering according to the XML Schema
The cells in a workbook can be calculated in different orders depending on various optimizations and
dependencies. The calculation chain object specifies the order in which the cells in a workbook were last calculated.
@author Yegor Kozlov
Remove a formula reference from the calculation chain
@param sheetId the sheet Id of a sheet the formula belongs to.
@param ref A1 style reference to the cell Containing the formula.
XML Beans uses a list, which is very slow
to search, so we wrap things with our own
map for fast Lookup.
Called after the reference is updated, so that
we can reflect that in our cache
Searches the author. If not found he is added to the list of authors.
author to search
index of the author
A UDFFinder that can retrieve functions both by name and by fake index.
@author Yegor Kozlov
This class : the Custom XML Mapping Part (Open Office XML Part 1:
chapter 12.3.6)
An instance of this part type Contains a schema for an XML file, and
information on the behavior that is used when allowing this custom XML schema
to be mapped into the spreadsheet.
@author Roberto Manicardi
@return the internal data object
Gets the
@param schemaId the schema ID
@return CTSchema by it's ID
@return all the mappings configured in this document
Returns the parent XSSFWorkbook
@return the parent XSSFWorkbook
Table of strings shared across all sheets in a workbook.
A workbook may contain thousands of cells Containing string (non-numeric) data. Furthermore this data is very
likely to be repeated across many rows or columns. The goal of implementing a single string table that is shared
across the workbook is to improve performance in opening and saving the file by only Reading and writing the
repetitive information once.
Consider for example a workbook summarizing information for cities within various countries. There may be a
column for the name of the country, a column for the name of each city in that country, and a column
Containing the data for each city. In this case the country name is repetitive, being duplicated in many cells.
In many cases the repetition is extensive, and a tremendous savings is realized by making use of a shared string
table when saving the workbook. When displaying text in the spreadsheet, the cell table will just contain an
index into the string table as the value of a cell, instead of the full string.
The shared string table Contains all the necessary information for displaying the string: the text, formatting
properties, and phonetic properties (for East Asian languages).
@author Nick Birch
@author Yegor Kozlov
Array of individual string items in the Shared String table.
Maps strings and their indexes in the strings
arrays
An integer representing the total count of strings in the workbook. This count does not
include any numbers, it counts only the total of text strings in the workbook.
An integer representing the total count of unique strings in the Shared String Table.
A string is unique even if it is a copy of another string, but has different formatting applied
at the character level.
Return a string item by index
@param idx index of item to return.
@return the item at the specified position in this Shared String table.
Add an entry to this Shared String table (a new value is appened to the end).
If the Shared String table already Contains this CT_Rst
bean, its index is returned.
Otherwise a new entry is aded.
@param st the entry to add
@return index the index of Added entry
this table out as XML.
@param out The stream to write to.
@throws IOException if an error occurs while writing.
Return an integer representing the total count of strings in the workbook. This count does not
include any numbers, it counts only the total of text strings in the workbook.
@return the total count of strings in the workbook
Returns an integer representing the total count of unique strings in the Shared String Table.
A string is unique even if it is a copy of another string, but has different formatting applied
at the character level.
@return the total count of unique strings in the workbook
Provide low-level access to the underlying array of CT_Rst beans
@return array of CT_Rst beans
This class : the Single Cell Tables Part (Open Office XML Part 4:
chapter 3.5.2)
@author Roberto Manicardi
@return all the SimpleXmlCell Contained in this SingleXmlCells element
Table of styles shared across all sheets in a workbook.
@author ugo
The first style id available for use as a custom style
Create a new, empty StylesTable
Read this shared styles table from an XML file.
@param is The input stream Containing the XML document.
@throws IOException if an error occurs while Reading.
Records the given font in the font table.
Will re-use an existing font index if this
font matches another, EXCEPT if forced
registration is requested.
This allows people to create several fonts
then customise them later.
Note - End Users probably want to call
{@link XSSFFont#registerTo(StylesTable)}
For unit testing only!
Write this table out as XML.
@param out The stream to write to.
@throws IOException if an error occurs while writing.
Finds a font that matches the one with the supplied attributes
get the size of cell styles
For unit testing only
For unit testing only
For unit testing only
Class that represents theme of XLSX document. The theme includes specific
colors and fonts.
@author Petr Udalau(Petr.Udalau at exigenservices.com) - theme colors
If the colour is based on a theme, then inherit
information (currently just colours) from it as
required.
Base class for all axis types.
@author Roman Kashitsyn
@author Roman Kashitsyn
@return new scatter chart data instance
@return factory instance
Represents a SpreadsheetML chart legend
@author Roman Kashitsyn
Underlaying CTLagend bean
Create a new SpreadsheetML chart legend
Return the underlying CTLegend bean.
@return the underlying CTLegend bean
Package private class with utility methods.
@author Roman Kashitsyn
Builds CTAxDataSource object content from POI ChartDataSource.
@param ctAxDataSource OOXML data source to build
@param dataSource POI data source to use
Builds CTNumDataSource object content from POI ChartDataSource
@param ctNumDataSource OOXML data source to build
@param dataSource POI data source to use
List of all data series.
Represents a SpreadsheetML manual layout.
@author Roman Kashitsyn
Underlaying CTManualLayout bean.
Create a new SpreadsheetML manual layout.
@param layout a Spreadsheet ML layout that should be used as base.
Create a new SpreadsheetML manual layout for chart.
@param chart a chart to create layout for.
Return the underlying CTManualLayout bean.
@return the underlying CTManualLayout bean.
Represents DrawingML scatter chart.
@author Roman Kashitsyn
List of all data series.
Package private ScatterChartSerie implementation.
Returns data source used for X axis values.
@return data source used for X axis values
Returns data source used for Y axis values.
@return data source used for Y axis values
@param useCache if true, cached results will be Added on plot
Value axis type.
@author Roman Kashitsyn
Cell Settings avaiable in the Format/Alignment tab
Creates a Cell Alignment from the supplied XML defInition
@param cellAlignment
Access to low-level data
Get the type of vertical alignment for the cell
@return the type of aligment
@see VerticalAlignment
Get the type of horizontal alignment for the cell
@return the type of aligment
@see HorizontalAlignment
Get the number of spaces to indent the text in the cell
@return indent - number of spaces
Whether the text should be wrapped
@return a bool value indicating if the text in a cell should be line-wrapped within the cell.
The enumeration value indicating the side being used for a cell border.
This element Contains border formatting information, specifying border defInition formats (left, right, top, bottom, diagonal)
for cells in the workbook.
Color is optional.
Creates a Cell Border from the supplied XML defInition
Creates a Cell Border from the supplied XML defInition
Creates a new, empty Cell Border.
You need to attach this to the Styles Table
Records the Themes Table that is associated with
the current font, used when looking up theme
based colours and properties.
Returns the underlying XML bean.
@return CT_Border
Get the type of border to use for the selected border
@param side - - where to apply the color defInition
@return borderstyle - the type of border to use. default value is NONE if border style is not Set.
@see BorderStyle
Set the type of border to use for the selected border
@param side - - where to apply the color defInition
@param style - border style
@see BorderStyle
Get the color to use for the selected border
@param side - where to apply the color defInition
@return color - color to use as XSSFColor. null if color is not set
Set the color to use for the selected border
@param side - where to apply the color defInition
@param color - the color to use
This element specifies fill formatting.
A cell fill consists of a background color, foreground color, and pattern to be applied across the cell.
Creates a CellFill from the supplied parts
@param fill - fill
Creates an empty CellFill
Get the background fill color.
@return fill color, null if color is not set
Set the background fill color represented as a indexed color value.
@param index
Set the background fill color represented as a {@link XSSFColor} value.
@param color
Get the foreground fill color.
@return XSSFColor - foreground color. null if color is not set
Set the foreground fill color as a indexed color value
@param index - the color to use
Set the foreground fill color represented as a {@link XSSFColor} value.
@param color - the color to use
get the fill pattern
@return fill pattern type. null if fill pattern is not set
set the fill pattern
@param patternType fill pattern to use
Returns the underlying XML bean.
@return CT_Fill
Parent class of all XSSF headers and footers.
Create an instance of XSSFHeaderFooter from the supplied XML bean
@param headerFooter
Returns the underlying CTHeaderFooter xml bean
@return the underlying CTHeaderFooter xml bean
Are fields currently being stripped from the text that this
{@link XSSFHeaderFooter} returns? Default is false, but can be Changed
Should fields (eg macros) be stripped from the text that this class
returns? Default is not to strip.
@param StripFields
Removes any fields (eg macros, page markers etc) from the string.
Normally used to make some text suitable for showing to humans, and the
resultant text should not normally be saved back into the document!
get the text representing the center part of this element
get the text representing the left part of this element
get the text representing the right part of this element
Helper class for dealing with the Column Settings on
a CT_Worksheet (the data part of a sheet).
Note - within POI, we use 0 based column indexes, but
the column defInitions in the XML are 1 based!
Returns the Column at the given 0 based index
Returns the Column at the given 1 based index.
POI default is 0 based, but the file stores
as 1 based.
Does the column at the given 0 based index exist
in the supplied list of column defInitions?
Return the CT_Col at the given (0 based) column index,
creating it if required.
Split into left, center, right
Utility to update formulas and named ranges when a sheet name was Changed
@author Yegor Kozlov
Update sheet name in all formulas and named ranges.
Called from {@link XSSFWorkbook#SetSheetName(int, String)}
The idea is to parse every formula and render it back to string
with the updated sheet name. The IFormulaParsingWorkbook passed to the formula Parser
is constructed from the old workbook (sheet name is not yet updated) and
the FormulaRenderingWorkbook passed to FormulaRenderer#toFormulaString is a custom implementation that
returns the new sheet name.
@param sheetIndex the 0-based index of the sheet being Changed
@param name the new sheet name
Parse cell formula and re-assemble it back using the specified FormulaRenderingWorkbook.
@param cell the cell to update
@param frwb the formula rendering workbbok that returns new sheet name
Parse formula in the named range and re-assemble it back using the specified FormulaRenderingWorkbook.
@param name the name to update
@param frwb the formula rendering workbbok that returns new sheet name
@author Yegor Kozlov
Shift merged regions
@param startRow the row to start Shifting
@param endRow the row to end Shifting
@param n the number of rows to shift
@return an array of affected cell regions
Check if the row and column are in the specified cell range
@param cr the cell range to check in
@param rowIx the row to check
@param colIx the column to check
@return true if the range Contains the cell [rowIx,colIx]
Updated named ranges
Update formulas.
Shift a formula using the supplied FormulaShifter
@param row the row of the cell this formula belongs to. Used to get a reference to the parent workbook.
@param formula the formula to shift
@param Shifter the FormulaShifter object that operates on the Parsed formula tokens
@return the Shifted formula if the formula was Changed,
null
if the formula wasn't modified
*
* This class is a wrapper around the CTSingleXmlCell (Open Office XML Part 4:
* chapter 3.5.2.1)
*
*
* @author Roberto Manicardi
*
Gets the XSSFCell referenced by the R attribute or Creates a new one if cell doesn't exists
@return the referenced XSSFCell, null if the cell reference is invalid
This class is a wrapper around the CT_XmlColumnPr (Open Office XML Part 4:
chapter 3.5.1.7)
@author Roberto Manicardi
(see Open Office XML Part 4: chapter 3.5.1.3)
@return An integer representing the unique identifier of this column.
If the XPath is, for example, /Node1/Node2/Node3 and /Node1/Node2 is the common XPath for the table, the local XPath is /Node3
@return the local XPath
An anchor is what specifics the position of a shape within a client object
or within another containing shape.
@author Yegor Kozlov
Represents autofiltering for the specified worksheet.
@author Yegor Kozlov
@author Yegor Kozlov
High level representation of a cell in a row of a spreadsheet.
Cells can be numeric, formula-based or string-based (text). The cell type
specifies this. String cells cannot conatin numbers and numeric cells cannot
contain strings (at least according to our model). Client apps should do the
conversions themselves. Formula cells have the formula string, as well as
the formula result, which can be numeric or string.
Cells should have their number (0 based) before being Added to a row. Only
cells that have values should be Added.
the xml bean Containing information about the cell's location, value,
data type, formatting, and formula
the XSSFRow this cell belongs to
0-based column index
Table of strings shared across this workbook.
If two cells contain the same string, then the cell value is the same index into SharedStringsTable
Table of cell styles shared across all cells in a workbook.
Construct a XSSFCell.
@param row the parent row.
@param cell the xml bean Containing information about the cell.
@return table of strings shared across this workbook
@return table of cell styles shared across this workbook
Set a bool value for the cell
@param value the bool value to Set this cell to. For formulas we'll Set the
precalculated value, for bools we'll Set its value. For other types we
will change the cell to a bool cell and Set its value.
Set a numeric value for the cell
@param value the numeric value to Set this cell to. For formulas we'll Set the
precalculated value, for numerics we'll Set its value. For other types we
will change the cell to a numeric cell and Set its value.
Set a string value for the cell.
@param str value to Set the cell to. For formulas we'll Set the formula
cached string result, for String cells we'll Set its value. For other types we will
change the cell to a string cell and Set its value.
If value is null then we will change the cell to a Blank cell.
Set a string value for the cell.
@param str value to Set the cell to. For formulas we'll Set the 'pre-Evaluated result string,
for String cells we'll Set its value. For other types we will
change the cell to a string cell and Set its value.
If value is null then we will change the cell to a Blank cell.
Creates a non shared formula from the shared formula counterpart
Shared Group Index
non shared formula created for the given shared formula and this cell
Sets formula for this cell.
Note, this method only Sets the formula string and does not calculate the formula value.
To Set the precalculated value use {@link #setCellValue(double)} or {@link #setCellValue(String)}
@param formula the formula to Set, e.g. "SUM(C4:E4)"
.
If the argument is null
then the current formula is Removed.
@throws NPOI.ss.formula.FormulaParseException if the formula has incorrect syntax or is otherwise invalid
@throws InvalidOperationException if the operation is not allowed, for example,
when the cell is a part of a multi-cell array formula
Returns an A1 style reference to the location of this cell
A1 style reference to the location of this cell
Detect cell type based on the "t" attribute of the CT_Cell bean
Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as a date.
the date value to Set this cell to. For formulas we'll set the precalculated value,
for numerics we'll Set its value. For other types we will change the cell to a numeric cell and Set its value.
Set a error value for the cell
the error value to Set this cell to.
For formulas we'll Set the precalculated value , for errors we'll set
its value. For other types we will change the cell to an error cell and Set its value.
Sets this cell as the active cell for the worksheet.
Blanks this cell. Blank cells have no formula or value but may have styling.
This method erases all the data previously associated with this cell.
Sets column index of this cell
Set the cells type (numeric, formula or string)
Returns a string representation of the cell
Formula cells return the formula string, rather than the formula result.
Dates are displayed in dd-MMM-yyyy format
Errors are displayed as #ERR<errIdx>
Returns the raw, underlying ooxml value for the cell
If the cell Contains a string, then this value is an index into
the shared string table, pointing to the actual string value. Otherwise,
the value of the cell is expressed directly in this element. Cells Containing formulas express
the last calculated result of the formula in this element.
@return the raw cell value as Contained in the underlying CT_Cell bean,
null
for blank cells.
Used to help format error messages
Used to help format error messages
@throws RuntimeException if the bounds are exceeded.
Removes the comment for this cell, if there is one.
Returns the xml bean containing information about the cell's location (reference), value,
data type, formatting, and formula
@return the xml bean containing information about this cell
Chooses a new bool value for the cell when its type is changing.
Usually the caller is calling SetCellType() with the intention of calling
SetCellValue(bool) straight afterwards. This method only exists to give
the cell a somewhat reasonable value until the SetCellValue() call (if at all).
TODO - perhaps a method like SetCellTypeAndValue(int, Object) should be introduced to avoid this
The purpose of this method is to validate the cell state prior to modification
@see #NotifyArrayFormulaChanging()
Called when this cell is modified.The purpose of this method is to validate the cell state prior to modification.
if modification is not allowed
Returns the sheet this cell belongs to
@return the sheet this cell belongs to
Returns the row this cell belongs to
@return the row this cell belongs to
Get the value of the cell as a bool.
For strings, numbers, and errors, we throw an exception. For blank cells we return a false.
@return the value of the cell as a bool
@throws InvalidOperationException if the cell type returned by {@link #CellType}
is not CellType.Boolean, CellType.Blank or CellType.Formula
Get the value of the cell as a number.
For strings we throw an exception. For blank cells we return a 0.
For formulas or error cells we return the precalculated value;
@return the value of the cell as a number
@throws InvalidOperationException if the cell type returned by {@link #CellType} is CellType.String
@exception NumberFormatException if the cell value isn't a parsable double
.
@see DataFormatter for turning this number into a string similar to that which Excel would render this number as.
Get the value of the cell as a string
For numeric cells we throw an exception. For blank cells we return an empty string.
For formulaCells that are not string Formulas, we throw an exception
@return the value of the cell as a string
Get the value of the cell as a XSSFRichTextString
For numeric cells we throw an exception. For blank cells we return an empty string.
For formula cells we return the pre-calculated value if a string, otherwise an exception
@return the value of the cell as a XSSFRichTextString
Return a formula for the cell, for example, SUM(C4:E4)
Returns zero-based column index of this cell
Returns zero-based row index of a row in the sheet that contains this cell
Return the cell's style.
Return the cell type.
Only valid for formula cells
Get the value of the cell as a date.
Returns the error message, such as #VALUE!
Get the value of the cell as an error code.
For strings, numbers, and bools, we throw an exception.
For blank cells we return a 0.
Returns cell comment associated with this cell
Returns hyperlink associated with this cell
High level representation of the the possible formatting information for the contents of the cells on a sheet in a
SpreadsheetML document.
@see NPOI.xssf.usermodel.XSSFWorkbook#CreateCellStyle()
@see NPOI.xssf.usermodel.XSSFWorkbook#getCellStyleAt(short)
@see NPOI.xssf.usermodel.XSSFCell#setCellStyle(NPOI.ss.usermodel.CellStyle)
Creates a Cell Style from the supplied parts
@param cellXfId The main XF for the cell. Must be a valid 0-based index into the XF table
@param cellStyleXfId Optional, style xf. A value of -1
means no xf.
@param stylesSource Styles Source to work off
Used so that StylesSource can figure out our location
Used so that StylesSource can figure out our location
Creates an empty Cell Style
Verifies that this style belongs to the supplied Workbook
Styles Source.
Will throw an exception if it belongs to a different one.
This is normally called when trying to assign a style to a
cell, to ensure the cell and the style are from the same
workbook (if they're not, it won't work)
@throws ArgumentException if there's a workbook mis-match
Clones all the style information from another
XSSFCellStyle, onto this one. This
XSSFCellStyle will then have all the same
properties as the source, but the two may
be edited independently.
Any stylings on this XSSFCellStyle will be lost!
The source XSSFCellStyle could be from another
XSSFWorkbook if you like. This allows you to
copy styles from one XSSFWorkbook to another.
Get the type of horizontal alignment for the cell
the type of alignment
Get the contents of the format string, by looking up
the StylesSource
@return the number format string
Gets the font for this style
@return Font - font
Get the type of vertical alignment for the cell
Set the color to use for the bottom border
@param color the color to use, null means no color
* Set the foreground fill color represented as a {@link XSSFColor} value.
*
* Note: Ensure Foreground color is Set prior to background color.
* @param color the color to use
* @see #setFillBackgroundColor(NPOI.xssf.usermodel.XSSFColor) )
Get a copy of the currently used CT_Fill, if none is used, return a new instance.
Get a copy of the currently used CT_Border, if none is used, return a new instance.
Set the font for this style
@param font a font object Created or retreived from the XSSFWorkbook object
@see NPOI.xssf.usermodel.XSSFWorkbook#CreateFont()
@see NPOI.xssf.usermodel.XSSFWorkbook#getFontAt(short)
Set the color to use for the left border as a {@link XSSFColor} value
@param color the color to use
Set the color to use for the right border as a {@link XSSFColor} value
@param color the color to use
Set the color to use for the top border as a {@link XSSFColor} value
@param color the color to use
Set the type of vertical alignment for the cell
@param align - align the type of alignment
@see NPOI.ss.usermodel.CellStyle#VERTICAL_TOP
@see NPOI.ss.usermodel.CellStyle#VERTICAL_CENTER
@see NPOI.ss.usermodel.CellStyle#VERTICAL_BOTTOM
@see NPOI.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
@see NPOI.ss.usermodel.VerticalAlignment
Gets border color
@param side the border side
@return the used color
Set the color to use for the selected border
@param side - where to apply the color defInition
@param color - the color to use
Get the cellAlignment object to use for manage alignment
@return XSSFCellAlignment - cell alignment
Return the CT_CellAlignment instance for alignment
@return CT_CellAlignment
Returns a hash code value for the object. The hash is derived from the underlying CT_Xf bean.
@return the hash code value for this style
Checks is the supplied style is equal to this style
@param o the style to check
@return true if the supplied style is equal to this style
Make a copy of this style. The underlying CT_Xf bean is Cloned,
the references to Fills and borders remain.
@return a copy of this style
Get the type of border to use for the right border of the cell
Get the color to use for the bottom border
Color is optional. When missing, IndexedColors.Automatic is implied.
@return the index of the color defInition, default value is {@link NPOI.ss.usermodel.IndexedColors#AUTOMATIC}
@see NPOI.ss.usermodel.IndexedColors
Get the color to use for the bottom border as a {@link XSSFColor}
@return the used color or null
if not Set
Get the index of the number format (numFmt) record used by this cell format.
@return the index of the number format
Get the background fill color.
Note - many cells are actually filled with a foreground fill, not a background fill
Get the background fill color.
Note - many cells are actually Filled with a foreground
Fill, not a background fill - see {@link #getFillForegroundColor()}
@see NPOI.xssf.usermodel.XSSFColor#getRgb()
@return XSSFColor - fill color or null
if not Set
Get the foreground fill color.
Many cells are Filled with this, instead of a
background color ({@link #getFillBackgroundColor()})
@see IndexedColors
@return fill color, default value is {@link NPOI.ss.usermodel.IndexedColors#AUTOMATIC}
Get the foreground fill color.
Get the foreground fill color.
Gets the index of the font for this style
@return short - font index
@see NPOI.xssf.usermodel.XSSFWorkbook#getFontAt(short)
Get whether the cell's using this style are to be hidden
@return bool - whether the cell using this style is hidden
Get the number of spaces to indent the text in the cell
@return indent - number of spaces
Get the index within the StylesTable (sequence within the collection of CT_Xf elements)
@return unique index number of the underlying record this style represents
Get the color to use for the left border
@return the index of the color defInition, default value is {@link NPOI.ss.usermodel.IndexedColors#BLACK}
@see NPOI.ss.usermodel.IndexedColors
Get the color to use for the left border
@return the index of the color defInition or null
if not Set
@see NPOI.ss.usermodel.IndexedColors
Get whether the cell's using this style are locked
Get the color to use for the right border
Get the color to use for the right border
Get the degree of rotation (between 0 and 180 degrees) for the text in the cell
Expressed in degrees. Values range from 0 to 180. The first letter of
the text is considered the center-point of the arc.
For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the horizon is calculated as:
[degrees below horizon] = 90 - textRotation.
Get the color to use for the top border
@return the index of the color defInition, default value is {@link NPOI.ss.usermodel.IndexedColors#BLACK}
@see NPOI.ss.usermodel.IndexedColors
Get the color to use for the top border
Get the type of vertical alignment for the cell
Whether the text in a cell should be line-wrapped within the cell.
Represents a SpreadsheetML Chart
@author Nick Burch
@author Roman Kashitsyn
Parent graphic frame.
Root element of the SpreadsheetML Chart part
The Chart within that
Create a new SpreadsheetML chart
Construct a SpreadsheetML chart from a namespace part.
@param part the namespace part holding the chart data,
the content type must be application/vnd.Openxmlformats-officedocument.Drawingml.chart+xml
@param rel the namespace relationship holding this chart,
the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/chart
Construct a new CTChartSpace bean.
By default, it's just an empty placeholder for chart objects.
@return a new CTChartSpace bean
Return the underlying CTChartSpace bean, the root element of the SpreadsheetML Chart part.
@return the underlying CTChartSpace bean
Return the underlying CTChart bean, within the Chart Space
@return the underlying CTChart bean
Returns the parent graphic frame.
@return the graphic frame this chart belongs to
Sets the parent graphic frame.
@return true if only visible cells will be present on the chart,
false otherwise
@param plotVisOnly a flag specifying if only visible cells should be
present on the chart
Returns the title, or null if none is Set
High level representation of Sheet Parts that are of type 'chartsheet'.
Chart sheet is a special kind of Sheet that Contains only chart and no data.
@author Yegor Kozlov
High level representation of a SpreadsheetML worksheet.
Sheets are the central structures within a workbook, and are where a user does most of his spreadsheet work.
The most common type of sheet is the worksheet, which is represented as a grid of cells. Worksheet cells can
contain text, numbers, dates, and formulas. Cells can also be formatted.
cache of master shared formulas in this sheet.
Master shared formula is the first formula in a group of shared formulas is saved in the f element.
Creates new XSSFSheet - called by XSSFWorkbook to create a sheet from scratch.
@see NPOI.XSSF.usermodel.XSSFWorkbook#CreateSheet()
Creates an XSSFSheet representing the given namespace part and relationship.
Should only be called by XSSFWorkbook when Reading in an exisiting file.
@param part - The namespace part that holds xml data represenring this sheet.
@param rel - the relationship of the given namespace part in the underlying OPC namespace
Initialize worksheet data when Reading in an exisiting file.
Initialize worksheet data when creating a new sheet.
Read hyperlink relations, link them with CT_Hyperlink beans in this worksheet
and Initialize the internal array of XSSFHyperlink objects
Create a new CT_Worksheet instance with all values set to defaults
@return a new instance
Provide access to the CT_Worksheet bean holding this sheet's data
@return the CT_Worksheet bean holding this sheet's data
Adds a merged region of cells (hence those cells form one).
@param region (rowfrom/colfrom-rowto/colto) to merge
@return index of this region
Adjusts the column width to fit the contents.
This process can be relatively slow on large sheets, so this should
normally only be called once per column, at the end of your
Processing.
@param column the column index
Adjusts the column width to fit the contents.
This process can be relatively slow on large sheets, so this should
normally only be called once per column, at the end of your
Processing.
You can specify whether the content of merged cells should be considered or ignored.
Default is to ignore merged cells.
@param column the column index
@param useMergedCells whether to use the contents of merged cells when calculating the width of the column
Create a new SpreadsheetML drawing. If this sheet already Contains a drawing - return that.
@return a SpreadsheetML drawing
Get VML drawing for this sheet (aka 'legacy' drawig)
@param autoCreate if true, then a new VML drawing part is Created
@return the VML drawing of null
if the drawing was not found and autoCreate=false
Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
@param colSplit Horizonatal position of split.
@param rowSplit Vertical position of split.
Creates a split (freezepane). Any existing freezepane or split pane is overwritten.
If both colSplit and rowSplit are zero then the existing freeze pane is Removed
@param colSplit Horizonatal position of split.
@param rowSplit Vertical position of split.
@param leftmostColumn Left column visible in right pane.
@param topRow Top row visible in bottom pane
Creates a new comment for this sheet. You still
need to assign it to a cell though
@deprecated since Nov 2009 this method is not compatible with the common SS interfaces,
use {@link NPOI.XSSF.usermodel.XSSFDrawing#CreateCellComment
(NPOI.SS.usermodel.ClientAnchor)} instead
Create a new row within the sheet and return the high level representation
@param rownum row number
@return High level {@link XSSFRow} object representing a row in the sheet
@see #RemoveRow(NPOI.SS.usermodel.Row)
Creates a split pane. Any existing freezepane or split pane is overwritten.
@param xSplitPos Horizonatal position of split (in 1/20th of a point).
@param ySplitPos Vertical position of split (in 1/20th of a point).
@param topRow Top row visible in bottom pane
@param leftmostColumn Left column visible in right pane.
@param activePane Active pane. One of: PANE_LOWER_RIGHT,
PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT
@see NPOI.SS.usermodel.Sheet#PANE_LOWER_LEFT
@see NPOI.SS.usermodel.Sheet#PANE_LOWER_RIGHT
@see NPOI.SS.usermodel.Sheet#PANE_UPPER_LEFT
@see NPOI.SS.usermodel.Sheet#PANE_UPPER_RIGHT
Get the actual column width (in units of 1/256th of a character width )
Note, the returned value is always gerater that {@link #GetDefaultColumnWidth()} because the latter does not include margins.
Actual column width measured as the number of characters of the maximum digit width of the
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. There are 4 pixels of margin
pAdding (two on each side), plus 1 pixel pAdding for the gridlines.
@param columnIndex - the column to set (0-based)
@return width - the width in units of 1/256th of a character width
Returns the CellStyle that applies to the given
(0 based) column, or null if no style has been
set for that column
Gets the size of the margin in inches.
@param margin which margin to get
@return the size of the margin
@see Sheet#LeftMargin
@see Sheet#RightMargin
@see Sheet#TopMargin
@see Sheet#BottomMargin
@see Sheet#HeaderMargin
@see Sheet#FooterMargin
Sets the size of the margin in inches.
@param margin which margin to get
@param size the size of the margin
@see Sheet#LeftMargin
@see Sheet#RightMargin
@see Sheet#TopMargin
@see Sheet#BottomMargin
@see Sheet#HeaderMargin
@see Sheet#FooterMargin
@return the merged region at the specified index
@throws InvalidOperationException if this worksheet does not contain merged regions
Enables sheet protection and Sets the password for the sheet.
Also Sets some attributes on the {@link CT_SheetProtection} that correspond to
the default values used by Excel
@param password to set for protection. Pass null
to remove protection
Converts a String to a {@link STUnsignedshortHex} value that Contains the {@link PasswordRecord#hashPassword(String)}
value in hexadecimal format
@param password the password string you wish convert to an {@link STUnsignedshortHex}
@return {@link STUnsignedshortHex} that Contains Excel hashed password in Hex format
Returns the logical row ( 0-based). If you ask for a row that is not
defined you get a null. This is to say row 4 represents the fifth row on a sheet.
@param rownum row to get
@return XSSFRow
representing the rownumber or null
if its not defined on the sheet
Ensure CT_Worksheet.CT_SheetPr.CT_OutlinePr
Group between (0 based) columns
Tie a range of cell toGether so that they can be collapsed or expanded
@param fromRow start row (0-based)
@param toRow end row (0-based)
Determines if there is a page break at the indicated column
Get the hidden state for a given column.
@param columnIndex - the column to set (0-based)
@return hidden - false
if the column is visible
Tests if there is a page break at the indicated row
@param row index of the row to test
@return true
if there is a page break at the indicated row
Sets a page break at the indicated row
Breaks occur above the specified row and left of the specified column inclusive.
For example, sheet.SetColumnBreak(2);
breaks the sheet into two parts
with columns A,B,C in the first and D,E,... in the second. Simuilar, sheet.SetRowBreak(2);
breaks the sheet into two parts with first three rows (rownum=1...3) in the first part
and rows starting with rownum=4 in the second.
@param row the row to break, inclusive
Removes a page break at the indicated column
Removes a merged region of cells (hence letting them free)
@param index of the region to unmerge
Remove a row from this sheet. All cells Contained in the row are Removed as well
@param row the row to Remove.
Removes the page break at the indicated row
Sets a page break at the indicated column.
Breaks occur above the specified row and left of the specified column inclusive.
For example, sheet.SetColumnBreak(2);
breaks the sheet into two parts
with columns A,B,C in the first and D,E,... in the second. Simuilar, sheet.SetRowBreak(2);
breaks the sheet into two parts with first three rows (rownum=1...3) in the first part
and rows starting with rownum=4 in the second.
@param column the column to break, inclusive
Sets all adjacent columns of the same outline level to the specified
hidden status.
@param pIdx
the col info index of the start of the outline group
@return the column index of the last column in the outline group
'Collapsed' state is stored in a single column col info record
immediately after the outline group
@param idx
@return a bool represented if the column is collapsed
Get the visibility state for a given column.
@param columnIndex - the column to get (0-based)
@param hidden - the visiblity state of the column
group the row It is possible for collapsed to be false and yet still have
the rows in question hidden. This can be achieved by having a lower
outline level collapsed, thus hiding all the child rows. Note that in
this case, if the lowest level were expanded, the middle level would
remain collapsed.
@param rowIndex -
the row involved, 0 based
@param collapse -
bool value for collapse
@param rowIndex the zero based row index to collapse
@param rowIndex the zero based row index to find from
@param rowNumber the zero based row index to expand
@param row the zero based row index to find from
@param row the zero based row index to find from
@param row the zero based row index to find from
Sets the zoom magnication for the sheet. The zoom is expressed as a
fraction. For example to express a zoom of 75% use 3 for the numerator
and 4 for the denominator.
@param numerator The numerator for the zoom magnification.
@param denominator The denominator for the zoom magnification.
@see #SetZoom(int)
Location of the top left visible cell Location of the top left visible cell in the bottom right
pane (when in Left-to-Right mode).
@param toprow the top row to show in desktop window pane
@param leftcol the left column to show in desktop window pane
Ungroup a range of rows that were previously groupped
@param fromRow start row (0-based)
@param toRow end row (0-based)
Assign a cell comment to a cell region in this worksheet
@param cellRef cell region
@param comment the comment to assign
@deprecated since Nov 2009 use {@link XSSFCell#SetCellComment(NPOI.SS.usermodel.Comment)} instead
Register a hyperlink in the collection of hyperlinks on this sheet
@param hyperlink the link to add
Return the default sheet view. This is the last one if the sheet's views, according to sec. 3.3.1.83
of the OOXML spec: "A single sheet view defInition. When more than 1 sheet view is defined in the file,
it means that when opening the workbook, each sheet view corresponds to a separate window within the
spreadsheet application, where each window is Showing the particular sheet. Containing the same
workbookViewId value, the last sheetView defInition is loaded, and the others are discarded.
When multiple windows are viewing the same sheet, multiple sheetView elements (with corresponding
workbookView entries) are saved."
Returns the sheet's comments object if there is one,
or null if not
@param create create a new comments table if it does not exist
Return a master shared formula by index
@param sid shared group index
@return a CT_CellFormula bean holding shared formula or null
if not found
Enable sheet protection
Disable sheet protection
Enable Autofilters locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Deleting columns locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Deleting rows locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Formatting cells locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Formatting columns locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Formatting rows locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Inserting columns locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Inserting hyperlinks locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Inserting rows locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Pivot Tables locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Sort locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Objects locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Scenarios locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Selection of locked cells locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Enable Selection of unlocked cells locking.
This does not modify sheet protection status.
To enforce this locking, call {@link #enableLocking()}
Also Creates cells if they don't exist
Creates a new Table, and associates it with this Sheet
Returns any tables associated with this Sheet
Set background color of the sheet tab
@param colorIndex the indexed color to set, must be a constant from {@link IndexedColors}
Returns the parent XSSFWorkbook
@return the parent XSSFWorkbook
Returns the name of this sheet
@return the name of this sheet
Vertical page break information used for print layout view, page layout view, drawing print breaks
in normal view, and for printing the worksheet.
@return column indexes of all the vertical page breaks, never null
Get the default column width for the sheet (if the columns do not define their own width) in
characters.
Note, this value is different from {@link #GetColumnWidth(int)}. The latter is always greater and includes
4 pixels of margin pAdding (two on each side), plus 1 pixel pAdding for the gridlines.
@return column width, default value is 8
Get the default row height for the sheet (if the rows do not define their own height) in
twips (1/20 of a point)
@return default row height
Get the default row height for the sheet measued in point size (if the rows do not define their own height).
@return default row height in points
Whether the text is displayed in right-to-left mode in the window
@return whether the text is displayed in right-to-left mode in the window
Get whether to display the guts or not,
default value is true
@return bool - guts or no guts
Gets the flag indicating whether the window should show 0 (zero) in cells Containing zero value.
When false, cells with zero value appear blank instead of Showing the number zero.
@return whether all zero values on the worksheet are displayed
Gets the first row on the sheet
@return the number of the first logical row on the sheet, zero based
Flag indicating whether the Fit to Page print option is enabled.
@return true
Returns the default footer for the sheet,
creating one as needed.
You may also want to look at
{@link #GetFirstFooter()},
{@link #GetOddFooter()} and
{@link #GetEvenFooter()}
Returns the default header for the sheet,
creating one as needed.
You may also want to look at
{@link #GetFirstHeader()},
{@link #GetOddHeader()} and
{@link #GetEvenHeader()}
Returns the odd footer. Used on all pages unless
other footers also present, when used on only
odd pages.
Returns the even footer. Not there by default, but
when Set, used on even pages.
Returns the first page footer. Not there by
default, but when Set, used on the first page.
Returns the odd header. Used on all pages unless
other headers also present, when used on only
odd pages.
Returns the even header. Not there by default, but
when Set, used on even pages.
Returns the first page header. Not there by
default, but when Set, used on the first page.
Determine whether printed output for this sheet will be horizontally centered.
Returns the number of merged regions defined in this worksheet
@return number of merged regions in this worksheet
Returns the information regarding the currently configured pane (split or freeze).
@return null if no pane configured, or the pane information.
Returns the number of phsyically defined rows (NOT the number of rows in the sheet)
@return the number of phsyically defined rows
Gets the print Setup object.
@return The user model for the print Setup object.
Answer whether protection is enabled or disabled
@return true => protection enabled; false => protection disabled
Horizontal page break information used for print layout view, page layout view, drawing print breaks in normal
view, and for printing the worksheet.
@return row indexes of all the horizontal page breaks, never null
Flag indicating whether summary rows appear below detail in an outline, when Applying an outline.
When true a summary row is inserted below the detailed data being summarized and a
new outline level is established on that row.
When false a summary row is inserted above the detailed data being summarized and a new outline level
is established on that row.
@return true
if row summaries appear below detail in the outline
Flag indicating whether summary columns appear to the right of detail in an outline, when Applying an outline.
When true a summary column is inserted to the right of the detailed data being summarized
and a new outline level is established on that column.
When false a summary column is inserted to the left of the detailed data being
summarized and a new outline level is established on that column.
@return true
if col summaries appear right of the detail in the outline
A flag indicating whether scenarios are locked when the sheet is protected.
The top row in the visible view when the sheet is first viewed after opening it in a viewer
Determine whether printed output for this sheet will be vertically centered.
@return whether printed output for this sheet will be vertically centered.
Gets the flag indicating whether this sheet should display formulas.
@return true
if this sheet should display formulas.
Gets the flag indicating whether this sheet displays the lines
between rows and columns to make editing and Reading easier.
@return true
if this sheet displays gridlines.
@see #isPrintGridlines() to check if printing of gridlines is turned on or off
Gets the flag indicating whether this sheet should display row and column headings.
Row heading are the row numbers to the side of the sheet
Column heading are the letters or numbers that appear above the columns of the sheet
@return true
if this sheet should display row and column headings.
Returns whether gridlines are printed.
@return whether gridlines are printed
Whether Excel will be asked to recalculate all formulas when the
workbook is opened.
Flag indicating whether the sheet displays Automatic Page Breaks.
@return true
if the sheet displays Automatic Page Breaks.
Returns a flag indicating whether this sheet is selected.
When only 1 sheet is selected and active, this value should be in synch with the activeTab value.
In case of a conflict, the Start Part Setting wins and Sets the active sheet tab.
Note: multiple sheets can be selected, but only one sheet can be active at one time.
@return true
if this sheet is selected
Return location of the active cell, e.g. A1
.
@return the location of the active cell.
Does this sheet have any comments on it? We need to know,
so we can decide about writing it to disk or not
@return true when Autofilters are locked and the sheet is protected.
@return true when Deleting columns is locked and the sheet is protected.
@return true when Deleting rows is locked and the sheet is protected.
@return true when Formatting cells is locked and the sheet is protected.
@return true when Formatting columns is locked and the sheet is protected.
@return true when Formatting rows is locked and the sheet is protected.
@return true when Inserting columns is locked and the sheet is protected.
@return true when Inserting hyperlinks is locked and the sheet is protected.
@return true when Inserting rows is locked and the sheet is protected.
@return true when Pivot tables are locked and the sheet is protected.
@return true when Sorting is locked and the sheet is protected.
@return true when Objects are locked and the sheet is protected.
@return true when Scenarios are locked and the sheet is protected.
@return true when Selection of locked cells is locked and the sheet is protected.
@return true when Selection of unlocked cells is locked and the sheet is protected.
@return true when Sheet is Protected.
Provide access to the CTChartsheet bean holding this sheet's data
@return the CTChartsheet bean holding this sheet's data
@author Yegor Kozlov
A client anchor is attached to an excel worksheet. It anchors against
top-left and bottom-right cells.
@author Yegor Kozlov
Starting anchor point
Ending anchor point
Creates a new client anchor and defaults all the anchor positions to 0.
Creates a new client anchor and Sets the top-left and bottom-right
coordinates of the anchor.
@param dx1 the x coordinate within the first cell.
@param dy1 the y coordinate within the first cell.
@param dx2 the x coordinate within the second cell.
@param dy2 the y coordinate within the second cell.
@param col1 the column (0 based) of the first cell.
@param row1 the row (0 based) of the first cell.
@param col2 the column (0 based) of the second cell.
@param row2 the row (0 based) of the second cell.
Create XSSFClientAnchor from existing xml beans
@param cell1 starting anchor point
@param cell2 ending anchor point
Return starting anchor point
@return starting anchor point
Return ending anchor point
@return ending anchor point
Represents a color in SpreadsheetML
Create an instance of XSSFColor from the supplied XML bean
Create an new instance of XSSFColor
For RGB colours, but not ARGB (we think...)
Excel Gets black and white the wrong way around, so switch them
Standard Alpha Red Green Blue ctColor value (ARGB).
Standard Red Green Blue ctColor value (RGB) with applied tint.
Alpha values are ignored.
Return the ARGB value in hex format, eg FF00FF00.
Works for both regular and indexed colours.
Standard Alpha Red Green Blue ctColor value (ARGB).
Returns the underlying XML bean
@return the underlying XML bean
A bool value indicating the ctColor is automatic and system ctColor dependent.
Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors.
Standard Red Green Blue ctColor value (RGB).
If there was an A (Alpha) value, it will be stripped.
Specifies the tint value applied to the ctColor.
If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final
ctColor applied.
The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and
1.0 means 100% lighten. Also, 0.0 means no Change.
In loading the RGB value, it is Converted to HLS where HLS values are (0..HLSMAX), where
HLSMAX is currently 255.
Here are some examples of how to apply tint to ctColor:
If (tint < 0)
Lum' = Lum * (1.0 + tint)
For example: Lum = 200; tint = -0.5; Darken 50%
Lum' = 200 * (0.5) => 100
For example: Lum = 200; tint = -1.0; Darken 100% (make black)
Lum' = 200 * (1.0-1.0) => 0
If (tint > 0)
Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint))
For example: Lum = 100; tint = 0.75; Lighten 75%
Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75))
= 100 * .25 + (255 - 255 * .25)
= 25 + (255 - 63) = 25 + 192 = 217
For example: Lum = 100; tint = 1.0; Lighten 100% (make white)
Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1))
= 100 * 0 + (255 - 255 * 0)
= 0 + (255 - 0) = 255
@return the tint value
cached reference to the string with the comment text
Creates a new XSSFComment, associated with a given
low level comment object.
Sets the rich text string used by this comment.
@param string the XSSFRichTextString used by this object.
@return the xml bean holding this comment's properties
@return Name of the original comment author. Default value is blank.
@return the 0-based column of the cell that the comment is associated with.
@return the 0-based row index of the cell that the comment is associated with.
@return whether the comment is visible
@return the rich text string of the comment
@author Yegor Kozlov
@return array of CellRangeAddresss. Never null
Replaces an existing Conditional Formatting rule at position idx.
Excel allows to create up to 3 Conditional Formatting rules.
This method can be useful to modify existing Conditional Formatting rules.
@param idx position of the rule. Should be between 0 and 2.
@param cfRule - Conditional Formatting rule
Add a Conditional Formatting rule.
Excel allows to create up to 3 Conditional Formatting rules.
@param cfRule - Conditional Formatting rule
@return the Conditional Formatting rule at position idx.
@return number of Conditional Formatting rules.
@author Yegor Kozlov
Create a new border formatting structure if it does not exist,
otherwise just return existing object.
@return - border formatting object, never returns null
.
@return - border formatting object if defined, null
otherwise
Create a new font formatting structure if it does not exist,
otherwise just return existing object.
@return - font formatting object, never returns null
.
@return - font formatting object if defined, null
otherwise
Create a new pattern formatting structure if it does not exist,
otherwise just return existing object.
@return - pattern formatting object, never returns null
.
@return - pattern formatting object if defined, null
otherwise
Type of conditional formatting rule.
MUST be either {@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS}
or {@link ConditionalFormattingRule#CONDITION_TYPE_FORMULA}
@return the type of condition
The comparison function used when the type of conditional formatting is Set to
{@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS}
MUST be a constant from {@link NPOI.ss.usermodel.ComparisonOperator}
@return the conditional format operator
The formula used to Evaluate the first operand for the conditional formatting rule.
If the condition type is {@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS},
this field is the first operand of the comparison.
If type is {@link ConditionalFormattingRule#CONDITION_TYPE_FORMULA}, this formula is used
to determine if the conditional formatting is applied.
If comparison type is {@link ConditionalFormattingRule#CONDITION_TYPE_FORMULA} the formula MUST be a Boolean function
@return the first formula
The formula used to Evaluate the second operand of the comparison when
comparison type is {@link ConditionalFormattingRule#CONDITION_TYPE_CELL_VALUE_IS} and operator
is either {@link NPOI.ss.usermodel.ComparisonOperator#BETWEEN} or {@link NPOI.ss.usermodel.ComparisonOperator#NOT_BETWEEN}
@return the second formula
A connection shape Drawing element. A connection shape is a line, etc.
that connects two other shapes in this Drawing.
@author Yegor Kozlov
Represents a shape in a SpreadsheetML Drawing.
@author Yegor Kozlov
Parent Drawing
The parent shape, always not-null for shapes in groups
anchor that is used by this shape
Return the Drawing that owns this shape
@return the parent Drawing that owns this shape
@return the anchor that is used by this shape.
Returns xml bean with shape properties.
@return xml bean with shape properties.
Sets the color used to fill this shape using the solid fill pattern.
The color applied to the lines of this shape.
Gets the parent shape.
Whether this shape is not Filled with a color
@return true if this shape is not Filled with a color.
Construct a new XSSFConnector object.
@param Drawing the XSSFDrawing that owns this shape
@param ctShape the shape bean that holds all the shape properties
Initialize default structure of a new auto-shape
Gets the shape type, one of the constants defined in {@link NPOI.ss.usermodel.ShapeTypes}.
@return the shape type
@see NPOI.ss.usermodel.ShapeTypes
Creates a new XSSFRichTextString for you.
Creates a XSSFFormulaEvaluator, the object that Evaluates formula cells.
@return a XSSFFormulaEvaluator instance
Creates a XSSFClientAnchor. Use this object to position Drawing object in
a sheet
@return a XSSFClientAnchor instance
@see NPOI.ss.usermodel.Drawing
Handles data formats for XSSF.
Get the format index that matches the given format
string, creating a new format entry if required.
Aliases text to the proper format as required.
@param format string matching a built in format
@return index of format.
Get the format string that matches the given format index
@param index of a format
@return string represented at index of format or null if there is not a format at that index
@author Radhakrishnan J
@author Radhakrishnan J
@author Radhakrishnan J
Represents a SpreadsheetML Drawing
@author Yegor Kozlov
Root element of the SpreadsheetML Drawing part
Create a new SpreadsheetML Drawing
@see NPOI.xssf.usermodel.XSSFSheet#CreateDrawingPatriarch()
Construct a SpreadsheetML Drawing from a namespace part
@param part the namespace part holding the Drawing data,
the content type must be application/vnd.openxmlformats-officedocument.Drawing+xml
@param rel the namespace relationship holding this Drawing,
the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing
Construct a new CT_Drawing bean. By default, it's just an empty placeholder for Drawing objects
@return a new CT_Drawing bean
Return the underlying CT_Drawing bean, the root element of the SpreadsheetML Drawing part.
@return the underlying CT_Drawing bean
Constructs a textbox under the Drawing.
@param anchor the client anchor describes how this group is attached
to the sheet.
@return the newly Created textbox.
Creates a picture.
@param anchor the client anchor describes how this picture is attached to the sheet.
@param pictureIndex the index of the picture in the workbook collection of pictures,
{@link NPOI.xssf.usermodel.XSSFWorkbook#getAllPictures()} .
@return the newly Created picture shape.
Creates a chart.
the client anchor describes how this chart is attached to
the newly created chart
Add the indexed picture to this Drawing relations
@param pictureIndex the index of the picture in the workbook collection of pictures,
{@link NPOI.xssf.usermodel.XSSFWorkbook#getAllPictures()} .
Creates a simple shape. This includes such shapes as lines, rectangles,
and ovals.
@param anchor the client anchor describes how this group is attached
to the sheet.
@return the newly Created shape.
Creates a simple shape. This includes such shapes as lines, rectangles,
and ovals.
@param anchor the client anchor describes how this group is attached
to the sheet.
@return the newly Created shape.
Creates a simple shape. This includes such shapes as lines, rectangles,
and ovals.
@param anchor the client anchor describes how this group is attached
to the sheet.
@return the newly Created shape.
Creates a comment.
@param anchor the client anchor describes how this comment is attached
to the sheet.
@return the newly Created comment.
Creates a new graphic frame.
@param anchor the client anchor describes how this frame is attached
to the sheet
@return the newly Created graphic frame
Returns all charts in this Drawing.
Create and Initialize a CT_TwoCellAnchor that anchors a shape against top-left and bottom-right cells.
@return a new CT_TwoCellAnchor
@return list of shapes in this drawing
XSSF wrapper for a cell under Evaluation
@author Josh Micich
XSSF wrapper for a sheet under Evaluation
@author Josh Micich
Internal POI use only
@author Josh Micich
@return the sheet index of the sheet with the given external index.
@return the external sheet index of the sheet with the given internal
index. Used by some of the more obscure formula and named range things.
Fairly easy on XSSF (we think...) since the internal and external
indicies are the same
XSSF allows certain extra textual characters in the formula that
HSSF does not. As these can't be composed down to HSSF-compatible
Ptgs, this method strips them out for us.
Even page footer value. Corresponds to even printed pages.
Even page(s) in the sheet may not be printed, for example, if the print area is specified to be
a range such that it falls outside an even page's scope.
If no even footer is specified, then the odd footer's value is assumed for even page footers.
Create an instance of XSSFEvenFooter from the supplied XML bean
@see XSSFSheet#GetEvenFooter()
@param headerFooter
Get the content text representing the footer
@return text
Even page header value. Corresponds to even printed pages.
Even page(s) in the sheet may not be printed, for example, if the print area is specified to be
a range such that it falls outside an even page's scope.
If no even header is specified, then odd header value is assumed for even page headers.
Create an instance of XSSFEvenHeader from the supplied XML bean
@see XSSFSheet#GetEvenHeader()
@param headerFooter
Get the content text representing this header
@return text
Instantiates sub-classes of POIXMLDocumentPart depending on their relationship type
@author Yegor Kozlov
First page footer content. Corresponds to first printed page.
The first logical page in the sheet may not be printed, for example, if the print area is specified to
be a range such that it falls outside the first page's scope.
Create an instance of XSSFFirstFooter from the supplied XML bean
@see XSSFSheet#getFirstFooter()
@param headerFooter
Get the content text representing the footer
@return text
First page header content. Corresponds to first printed page.
The first logical page in the sheet may not be printed, for example, if the print area is specified to
be a range such that it falls outside the first page's scope.
Create an instance of XSSFFirstHeader from the supplied XML bean
@see XSSFSheet#getFirstHeader()
@param headerFooter
Get the content text representing this header
@return text
Represents a font used in a workbook.
@author Gisella Bronzetti
By default, Microsoft Office Excel 2007 uses the Calibry font in font size 11
By default, Microsoft Office Excel 2007 uses the Calibry font in font size 11
Default font color is black
@see NPOI.SS.usermodel.IndexedColors#BLACK
Create a new XSSFFont
@param font the underlying CT_Font bean
Create a new XSSFont. This method is protected to be used only by XSSFWorkbook
get the underlying CT_Font font
get the color value for the font
References a color defined as Standard Alpha Red Green Blue color value (ARGB).
@return XSSFColor - rgb color to use
get the color value for the font
References a color defined in theme.
@return short - theme defined to use
set character-set to use.
@param charset - charset
@see FontCharset
set character-set to use.
@param charset - charset
@see FontCharset
set character-set to use.
@param charSet
set the color for the font in Standard Alpha Red Green Blue color value
@param color - color to use
set the theme color for the font to use
@param theme - theme color to use
set an enumeration representing the style of underlining that is used.
The none style is equivalent to not using underlining at all.
The possible values for this attribute are defined by the FontUnderline
@param underline - FontUnderline enum value
**
Records the Themes Table that is associated with
the current font, used when looking up theme
based colours and properties.
get the font scheme property.
is used only in StylesTable to create the default instance of font
@return FontScheme
@see NPOI.XSSF.model.StylesTable#CreateDefaultFont()
set font scheme property
@param scheme - FontScheme enum value
@see FontScheme
set an enumeration representing the font family this font belongs to.
A font family is a set of fonts having common stroke width and serif characteristics.
@param family font family
@link #SetFamily(int value)
get a bool value for the boldness to use.
@return bool - bold
get character-set to use.
@return int - character-set (0-255)
@see NPOI.SS.usermodel.FontCharset
get the indexed color value for the font
References a color defined in IndexedColors.
@return short - indexed color to use
@see IndexedColors
get the font height in point.
@return short - height in point
@see #GetFontHeight()
get the name of the font (i.e. Arial)
@return String - a string representing the name of the font to use
get a bool value that specify whether to use italics or not
@return bool - value for italic
get a bool value that specify whether to use a strikeout horizontal line through the text or not
@return bool - value for strikeout
get normal,super or subscript.
@return short - offset type to use (none,super,sub)
@see Font#SS_NONE
@see Font#SS_SUPER
@see Font#SS_SUB
get type of text underlining to use
@return byte - underlining type
@see NPOI.SS.usermodel.FontUnderline
get the boldness to use
@return boldweight
@see #BOLDWEIGHT_NORMAL
@see #BOLDWEIGHT_BOLD
get the font family to use.
@return the font family to use
@see NPOI.SS.usermodel.FontFamily
get the index within the XSSFWorkbook (sequence within the collection of Font objects)
@return unique index number of the underlying record this Font represents (probably you don't care
unless you're comparing which one is which)
@author Yegor Kozlov
@return xssf color wrapper or null if color info is missing
Set font style options.
@param italic - if true, Set posture style to italic, otherwise to normal
@param bold if true, Set font weight to bold, otherwise to normal
Set font style options to default values (non-italic, non-bold)
Get the type of super or subscript for the font
@return super or subscript option
@see #SS_NONE
@see #SS_SUPER
@see #SS_SUB
@return font color index
Gets the height of the font in 1/20th point units
@return fontheight (in points/20); or -1 if not modified
Get the type of underlining for the font
@return font underlining type
@see #U_NONE
@see #U_SINGLE
@see #U_DOUBLE
@see #U_SINGLE_ACCOUNTING
@see #U_DOUBLE_ACCOUNTING
Get whether the font weight is Set to bold or not
@return bold - whether the font is bold or not
@return true if font style was Set to italic
Evaluates formula cells.
For performance reasons, this class keeps a cache of all previously calculated intermediate
cell values. Be sure to call {@link #ClearAllCachedResultValues()} if any workbook cells are Changed between
calls to Evaluate~ methods on this class.
@author Amol S. Deshmukh < amolweb at ya hoo dot com >
@author Josh Micich
@param stabilityClassifier used to optimise caching performance. Pass null
for the (conservative) assumption that any cell may have its defInition Changed After
Evaluation begins.
@deprecated (Sep 2009) (reduce overloading) use {@link #Create(XSSFWorkbook, NPOI.ss.formula.IStabilityClassifier, NPOI.ss.formula.udf.UDFFinder)}
@param stabilityClassifier used to optimise caching performance. Pass null
for the (conservative) assumption that any cell may have its defInition Changed After
Evaluation begins.
@param udfFinder pass null
for default (AnalysisToolPak only)
Should be called whenever there are major Changes (e.g. moving sheets) to input cells
in the Evaluated workbook.
Failure to call this method After changing cell values will cause incorrect behaviour
of the Evaluate~ methods of this class
If cell Contains a formula, the formula is Evaluated and returned,
else the CellValue simply copies the appropriate cell value from
the cell and also its cell type. This method should be preferred over
EvaluateInCell() when the call should not modify the contents of the
original cell.
@param cell
If cell Contains formula, it Evaluates the formula,
and saves the result of the formula. The cell
remains as a formula cell.
Else if cell does not contain formula, this method leaves
the cell unChanged.
Note that the type of the formula result is returned,
so you know what kind of value is also stored with
the formula.
int EvaluatedCellType = Evaluator.EvaluateFormulaCell(cell);
Be aware that your cell will hold both the formula,
and the result. If you want the cell Replaced with
the result of the formula, use {@link #Evaluate(NPOI.ss.usermodel.Cell)} }
@param cell The cell to Evaluate
@return The type of the formula result (the cell's type remains as HSSFCell.CELL_TYPE_FORMULA however)
If cell Contains formula, it Evaluates the formula, and
Puts the formula result back into the cell, in place
of the old formula.
Else if cell does not contain formula, this method leaves
the cell unChanged.
Note that the same instance of HSSFCell is returned to
allow chained calls like:
int EvaluatedCellType = Evaluator.EvaluateInCell(cell).CellType;
Be aware that your cell value will be Changed to hold the
result of the formula. If you simply want the formula
value computed for you, use {@link #EvaluateFormulaCell(NPOI.ss.usermodel.Cell)} }
@param cell
Loops over all cells in all sheets of the supplied
workbook.
For cells that contain formulas, their formulas are
Evaluated, and the results are saved. These cells
remain as formula cells.
For cells that do not contain formulas, no Changes
are made.
This is a helpful wrapper around looping over all
cells, and calling EvaluateFormulaCell on each one.
Loops over all cells in all sheets of the supplied
workbook.
For cells that contain formulas, their formulas are
Evaluated, and the results are saved. These cells
remain as formula cells.
For cells that do not contain formulas, no Changes
are made.
This is a helpful wrapper around looping over all
cells, and calling EvaluateFormulaCell on each one.
Returns a CellValue wrapper around the supplied ValueEval instance.
Represents DrawingML GraphicalObjectFrame.
@author Roman Kashitsyn
Construct a new XSSFGraphicFrame object.
@param Drawing the XSSFDrawing that owns this frame
@param ctGraphicFrame the XML bean that stores this frame content
Initialize default structure of a new graphic frame
Sets the frame macro.
Assign a DrawingML chart to the graphic frame.
Returns the frame name.
@return name of the frame
Returns the frame anchor.
@return the anchor this frame is attached to
Gets the frame id.
This class : the Map element (Open Office XML Part 4:
chapter 3.16.2)
This element Contains all of the properties related to the XML map,
and the behaviors expected during data refresh operations.
@author Roberto Manicardi
@return the list of Single Xml Cells that provide a map rule to this mapping.
@return the list of all Tables that provide a map rule to this mapping
Represents a defined named range in a SpreadsheetML workbook.
Defined names are descriptive text that is used to represents a cell, range of cells, formula, or constant value.
Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30
.
Example:
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sh = wb.CreateSheet("Sheet1");
//applies to the entire workbook
XSSFName name1 = wb.CreateName();
name1.SetNameName("FMLA");
name1.SetRefersToFormula("Sheet1!$B$3");
//applies to Sheet1
XSSFName name2 = wb.CreateName();
name2.SetNameName("SheetLevelName");
name2.SetComment("This name is scoped to Sheet1");
name2.SetLocalSheetId(0);
name2.SetRefersToFormula("Sheet1!$B$3");
@author Nick Burch
@author Yegor Kozlov
A built-in defined name that specifies the workbook's print area
A built-in defined name that specifies the row(s) or column(s) to repeat
at the top of each printed page.
A built-in defined name that refers to a range Containing the criteria values
to be used in Applying an advanced filter to a range of data
this defined name refers to the range Containing the filtered
output values resulting from Applying an advanced filter criteria to a source
range
A built-in defined name that refers to a consolidation area
A built-in defined name that specified that the range specified is from a database data source
A built-in defined name that refers to a sheet title.
Creates an XSSFName object - called internally by XSSFWorkbook.
@param name - the xml bean that holds data represenring this defined name.
@param workbook - the workbook object associated with the name
@see NPOI.XSSF.usermodel.XSSFWorkbook#CreateName()
Returns the underlying named range object
Compares this name to the specified object.
The result is true
if the argument is XSSFName and the
underlying CTDefinedName bean Equals to the CTDefinedName representing this name
@param o the object to compare this XSSFName
against.
@return true
if the XSSFName
are Equal;
false
otherwise.
Returns the name that will appear in the user interface for the defined name.
@return text name of this defined name
Returns the sheet index this name applies to.
@return the sheet index this name applies to, -1 if this name applies to the entire workbook
Indicates that the defined name refers to a user-defined function.
This attribute is used when there is an Add-in or other code project associated with the file.
@return true
indicates the name refers to a function.
Returns the function group index if the defined name refers to a function. The function
group defines the general category for the function. This attribute is used when there is
an Add-in or other code project associated with the file.
@return the function group index that defines the general category for the function
Get the sheets name which this named range is referenced to
@return sheet name, which this named range referred to.
Empty string if the referenced sheet name weas not found.
Is the name refers to a user-defined function ?
@return true
if this name refers to a user-defined function
Returns the comment the user provided when the name was Created.
@return the user comment for this named range
XSSF Implementation of a Hyperlink.
Note - unlike with HSSF, many kinds of hyperlink
are largely stored as relations of the sheet
Create a new XSSFHyperlink. This method is protected to be used only by XSSFCreationHelper
@param type - the type of hyperlink to create
Create a XSSFHyperlink amd Initialize it from the supplied CTHyperlink bean and namespace relationship
@param ctHyperlink the xml bean Containing xml properties
@param hyperlinkRel the relationship in the underlying OPC namespace which stores the actual link's Address
@return the underlying CTHyperlink object
Do we need to a relation too, to represent
this hyperlink?
Generates the relation if required
Get the reference of the cell this applies to,
es A55
Assigns this hyperlink to the given cell reference
Return the type of this hyperlink
@return the type of this hyperlink
Hyperlink Address. Depending on the hyperlink type it can be URL, e-mail, path to a file
@return the Address of this hyperlink
Return text label for this hyperlink
@return text to display
Location within target. If target is a workbook (or this workbook) this shall refer to a
sheet and cell or a defined name. Can also be an HTML anchor if target is HTML file.
@return location
Return the column of the first cell that Contains the hyperlink
@return the 0-based column of the first cell that Contains the hyperlink
Return the column of the last cell that Contains the hyperlink
@return the 0-based column of the last cell that Contains the hyperlink
Return the row of the first cell that Contains the hyperlink
@return the 0-based row of the cell that Contains the hyperlink
Return the row of the last cell that Contains the hyperlink
@return the 0-based row of the last cell that Contains the hyperlink
get or set additional text to help the user understand more about the hyperlink
Odd page footer value. Corresponds to odd printed pages.
Odd page(s) in the sheet may not be printed, for example, if the print area is specified to be
a range such that it falls outside an odd page's scope.
Create an instance of XSSFOddFooter from the supplied XML bean
@see XSSFSheet#GetOddFooter()
@param headerFooter
Get the content text representing the footer
@return text
Odd page header value. Corresponds to odd printed pages.
Odd page(s) in the sheet may not be printed, for example, if the print area is specified to be
a range such that it falls outside an odd page's scope.
Create an instance of XSSFOddHeader from the supplied XML bean
@see XSSFSheet#GetOddHeader()
@param headerFooter
Get the content text representing this header
@return text
@author Yegor Kozlov
Represents a picture shape in a SpreadsheetML Drawing.
@author Yegor Kozlov
Column width measured as the number of characters of the maximum digit width of the
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. There are 4 pixels of margin
pAdding (two on each side), plus 1 pixel pAdding for the gridlines.
This value is the same for default font in Office 2007 (Calibry) and Office 2003 and earlier (Arial)
A default instance of CTShape used for creating new shapes.
This object specifies a picture object and all its properties
Construct a new XSSFPicture object. This constructor is called from
{@link XSSFDrawing#CreatePicture(XSSFClientAnchor, int)}
@param Drawing the XSSFDrawing that owns this picture
Returns a prototype that is used to construct new shapes
@return a prototype that is used to construct new shapes
Link this shape with the picture data
@param rel relationship referring the picture data
Return the underlying CT_Picture bean that holds all properties for this picture
@return the underlying CT_Picture bean
Reset the image to the original size.
Please note, that this method works correctly only for workbooks
with the default font size (Calibri 11pt for .xlsx).
If the default font is Changed the resized image can be streched vertically or horizontally.
Reset the image to the original size.
Please note, that this method works correctly only for workbooks
with the default font size (Calibri 11pt for .xlsx).
If the default font is Changed the resized image can be streched vertically or horizontally.
@param scale the amount by which image dimensions are multiplied relative to the original size.
resize(1.0)
Sets the original size, resize(0.5)
resize to 50% of the original,
resize(2.0)
resizes to 200% of the original.
Calculate the preferred size for this picture.
@return XSSFClientAnchor with the preferred size for this image
Calculate the preferred size for this picture.
@param scale the amount by which image dimensions are multiplied relative to the original size.
@return XSSFClientAnchor with the preferred size for this image
Return the dimension of this image
@param part the namespace part holding raw picture data
@param type type of the picture: {@link Workbook#PICTURE_TYPE_JPEG},
{@link Workbook#PICTURE_TYPE_PNG} or {@link Workbook#PICTURE_TYPE_DIB}
@return image dimension in pixels
Raw picture data, normally attached to a SpreadsheetML Drawing.
As a rule, pictures are stored in the /xl/media/ part of a SpreadsheetML package.
Relationships for each known picture type
Create a new XSSFPictureData node
@see NPOI.xssf.usermodel.XSSFWorkbook#AddPicture(byte[], int)
Construct XSSFPictureData from a namespace part
@param part the namespace part holding the Drawing data,
@param rel the namespace relationship holding this Drawing,
the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/image
Suggests a file extension for this image.
@return the file extension.
Return an integer constant that specifies type of this picture
@return an integer constant that specifies type of this picture
@see NPOI.ss.usermodel.Workbook#PICTURE_TYPE_EMF
@see NPOI.ss.usermodel.Workbook#PICTURE_TYPE_WMF
@see NPOI.ss.usermodel.Workbook#PICTURE_TYPE_PICT
@see NPOI.ss.usermodel.Workbook#PICTURE_TYPE_JPEG
@see NPOI.ss.usermodel.Workbook#PICTURE_TYPE_PNG
@see NPOI.ss.usermodel.Workbook#PICTURE_TYPE_DIB
Gets the picture data as a byte array.
Page Setup and page margins Settings for the worksheet.
Set the paper size as enum value.
@param size value for the paper size.
Returns the paper size as enum.
@return PaperSize paper size
@see PaperSize
Orientation of the page: landscape - portrait.
@return Orientation of the page
@see PrintOrientation
Get print page order.
@return PageOrder
Returns the paper size.
@return short - paper size
Returns the scale.
@return short - scale
Set the page numbering start.
Page number for first printed page. If no value is specified, then 'automatic' is assumed.
@return page number for first printed page
Returns the number of pages wide to fit sheet in.
@return number of pages wide to fit sheet in
Returns the number of pages high to fit the sheet in.
@return number of pages high to fit the sheet in
Returns the left to right print order.
@return left to right print order
Returns the landscape mode.
@return landscape mode
Use the printer's defaults Settings for page Setup values and don't use the default values
specified in the schema. For example, if dpi is not present or specified in the XML, the
application shall not assume 600dpi as specified in the schema as a default and instead
shall let the printer specify the default dpi.
@return valid Settings
Returns the black and white Setting.
@return black and white Setting
Returns the draft mode.
@return draft mode
Returns the print notes.
@return print notes
Returns the no orientation.
@return no orientation
Returns the use page numbers.
@return use page numbers
Returns the horizontal resolution.
@return horizontal resolution
Returns the vertical resolution.
@return vertical resolution
Returns the header margin.
@return header margin
Returns the footer margin.
@return footer margin
Returns the number of copies.
@return number of copies
A map to lookup POIXMLRelation by its relation type
Fetches the InputStream to read the contents, based
of the specified core part, for which we are defined
as a suitable relationship
Get POIXMLRelation by relation type
@param rel relation type, for example,
http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
@return registered POIXMLRelation or null if not found
Removes the relation from the internal table.
Following readings of files will ignoring the removed relation.
Relation to remove
Adds the relation to the internal table.
Following readings of files will process the given relation.
Relation to add
Rich text unicode string. These strings can have fonts applied to arbitary parts of the string.
Most strings in a workbook have formatting applied at the cell level, that is, the entire string in the cell has the
same formatting applied. In these cases, the formatting for the cell is stored in the styles part,
and the string for the cell can be shared across the workbook. The following code illustrates the example.
cell1.SetCellValue(new XSSFRichTextString("Apache POI"));
cell2.SetCellValue(new XSSFRichTextString("Apache POI"));
cell3.SetCellValue(new XSSFRichTextString("Apache POI"));
In the above example all three cells will use the same string cached on workbook level.
Some strings in the workbook may have formatting applied at a level that is more granular than the cell level.
For instance, specific characters within the string may be bolded, have coloring, italicizing, etc.
In these cases, the formatting is stored along with the text in the string table, and is treated as
a unique entry in the workbook. The following xml and code snippet illustrate this.
XSSFRichTextString s1 = new XSSFRichTextString("Apache POI");
s1.ApplyFont(boldArial);
cell1.SetCellValue(s1);
XSSFRichTextString s2 = new XSSFRichTextString("Apache POI");
s2.ApplyFont(italicCourier);
cell2.SetCellValue(s2);
@author Yegor Kozlov
Create a rich text string
Create empty rich text string and Initialize it with empty string
Create a rich text string from the supplied XML bean
Applies a font to the specified characters of a string.
@param startIndex The start index to apply the font to (inclusive)
@param endIndex The end index to apply the font to (exclusive)
@param fontIndex The font to use.
Applies a font to the specified characters of a string.
@param startIndex The start index to apply the font to (inclusive)
@param endIndex The end index to apply to font to (exclusive)
@param font The index of the font to use.
Sets the font of the entire string.
@param font The font to use.
Applies the specified font to the entire string.
@param fontIndex the font to Apply.
Append new text to this text run and apply the specify font to it
@param text the text to append
@param font the font to apply to the Appended text or null
if no formatting is required
Append new text to this text run
@param text the text to append
Copy font attributes from CTFont bean into CTRPrElt bean
Removes any formatting that may have been applied to the string.
The index within the string to which the specified formatting run applies.
@param index the index of the formatting run
@return the index within the string.
Returns the number of characters this format run covers.
@param index the index of the formatting run
@return the number of characters this format run covers
Returns the plain string representation.
Gets a copy of the font used in a particular formatting Run.
@param index the index of the formatting run
@return A copy of the font used or null if no formatting is applied to the specified text Run.
Return a copy of the font in use at a particular index.
@param index The index.
@return A copy of the font that's currently being applied at that
index or null if no font is being applied or the
index is out of range.
Return the underlying xml bean
CTRPrElt --> CTFont adapter
**
For all characters which cannot be represented in XML as defined by the XML 1.0 specification,
the characters are escaped using the Unicode numerical character representation escape character
format _xHHHH_, where H represents a hexadecimal character in the character's value.
Example: The Unicode character 0D is invalid in an XML 1.0 document,
so it shall be escaped as _x000D_
.
See section 3.18.9 in the OOXML spec.
@param value the string to decode
@return the decoded string
Returns the number of characters in this string.
@return The number of formatting Runs used.
High level representation of a row of a spreadsheet.
the xml bean Containing all cell defInitions for this row
Cells of this row keyed by their column indexes.
The TreeMap ensures that the cells are ordered by columnIndex in the ascending order.
the parent sheet
Construct a XSSFRow.
@param row the xml bean Containing all cell defInitions for this row.
@param sheet the parent sheet.
Alias for {@link #cellIterator()} to allow foreach loops:
for(Cell cell : row){
...
}
@return an iterator over cells in this row.
Compares two XSSFRow
objects. Two rows are equal if they belong to the same worksheet and
their row indexes are Equal.
@param row the XSSFRow
to be Compared.
@return the value 0
if the row number of this XSSFRow
is
equal to the row number of the argument XSSFRow
; a value less than
0
if the row number of this this XSSFRow
is numerically less
than the row number of the argument XSSFRow
; and a value greater
than 0
if the row number of this this XSSFRow
is numerically
greater than the row number of the argument XSSFRow
.
@throws ArgumentException if the argument row belongs to a different worksheet
Returns the cell at the given (0 based) index,
with the {@link NPOI.SS.usermodel.Row.MissingCellPolicy} from the parent Workbook.
@return the cell at the given (0 based) index
Get the hssfcell representing a given column (logical cell)
0-based. If you ask for a cell that is not defined, then
you Get a null.
This is the basic call, with no policies applied
0 based column number
Cell representing that column or null if Undefined.
Applies a whole-row cell styling to the row.
If the value is null then the style information is Removed,
causing the cell to used the default workbook style.
Remove the Cell from this row.
@param cell the cell to remove
Returns the underlying CT_Row xml bean Containing all cell defInitions in this row
@return the underlying CT_Row xml bean
Fired when the document is written to an output stream.
@see NPOI.XSSF.usermodel.XSSFSheet#Write(java.io.OutputStream) ()
@return formatted xml representation of this row
update cell references when Shifting rows
@param n the number of rows to move
Returns the XSSFSheet this row belongs to
@return the XSSFSheet that owns this row
Get the number of the first cell Contained in this row.
@return short representing the first logical cell in the row,
or -1 if the row does not contain any cells.
Gets the index of the last cell Contained in this row PLUS ONE. The result also
happens to be the 1-based column number of the last cell. This value can be used as a
standard upper bound when iterating over cells:
short minColIx = row.GetFirstCellNum();
short maxColIx = row.GetLastCellNum();
for(short colIx=minColIx; colIx<maxColIx; colIx++) {
XSSFCell cell = row.GetCell(colIx);
if(cell == null) {
continue;
}
//... do something with cell
}
@return short representing the last logical cell in the row PLUS ONE,
or -1 if the row does not contain any cells.
Get the row's height measured in twips (1/20th of a point). If the height is not Set, the default worksheet value is returned,
See {@link NPOI.XSSF.usermodel.XSSFSheet#GetDefaultRowHeightInPoints()}
@return row height measured in twips (1/20th of a point)
Returns row height measured in point size. If the height is not Set, the default worksheet value is returned,
See {@link NPOI.XSSF.usermodel.XSSFSheet#GetDefaultRowHeightInPoints()}
@return row height measured in point size
@see NPOI.XSSF.usermodel.XSSFSheet#GetDefaultRowHeightInPoints()
Gets the number of defined cells (NOT number of cells in the actual row!).
That is to say if only columns 0,4,5 have values then there would be 3.
@return int representing the number of defined cells in the row.
Get row number this row represents
@return the row number (0 based)
Get whether or not to display this row with 0 height
@return - height is zero or not.
Is this row formatted? Most aren't, but some rows
do have whole-row styles. For those that do, you
can get the formatting from {@link #GetRowStyle()}
Returns the whole-row cell style. Most rows won't
have one of these, so will return null. Call
{@link #isFormatted()} to check first.
This object specifies a group shape that represents many shapes grouped together. This shape is to be treated
just as if it were a regular shape but instead of being described by a single geometry it is made up of all the
shape geometries encompassed within it. Within a group shape each of the shapes that make up the group are
specified just as they normally would.
@author Yegor Kozlov
Construct a new XSSFSimpleShape object.
@param Drawing the XSSFDrawing that owns this shape
@param ctGroup the XML bean that stores this group content
Initialize default structure of a new shape group
Constructs a textbox.
@param anchor the child anchor describes how this shape is attached
to the group.
@return the newly Created textbox.
Creates a simple shape. This includes such shapes as lines, rectangles,
and ovals.
@param anchor the child anchor describes how this shape is attached
to the group.
@return the newly Created shape.
Creates a simple shape. This includes such shapes as lines, rectangles,
and ovals.
@param anchor the child anchor describes how this shape is attached
to the group.
@return the newly Created shape.
Creates a picture.
@param anchor the client anchor describes how this picture is attached to the sheet.
@param pictureIndex the index of the picture in the workbook collection of pictures,
{@link XSSFWorkbook#getAllPictures()} .
@return the newly Created picture shape.
Sets the coordinate space of this group. All children are constrained
to these coordinates.
@author Yegor Kozlov
A factory method allowing to create a conditional formatting rule
with a cell comparison operator
TODO - formulas Containing cell references are currently not Parsed properly
@param comparisonOperation - a constant value from
{@link NPOI.hssf.record.CFRuleRecord.ComparisonOperator}:
- BETWEEN
- NOT_BETWEEN
- EQUAL
- NOT_EQUAL
- GT
- LT
- GE
- LE
@param formula1 - formula for the valued, Compared with the cell
@param formula2 - second formula (only used with
{@link NPOI.ss.usermodel.ComparisonOperator#BETWEEN}) and
{@link NPOI.ss.usermodel.ComparisonOperator#NOT_BETWEEN} operations)
Gets Conditional Formatting object at a particular index
@param index
of the Conditional Formatting object to fetch
@return Conditional Formatting object
Removes a Conditional Formatting object by index
@param index of a Conditional Formatting object to remove
@return number of Conditional Formatting objects of the sheet
Represents a shape with a predefined geometry in a SpreadsheetML Drawing.
Possible shape types are defined in {@link NPOI.ss.usermodel.ShapeTypes}
@author Yegor Kozlov
A default instance of CT_Shape used for creating new shapes.
Xml bean that stores properties of this shape
Prototype with the default structure of a new auto-shape.
Gets the shape type, one of the constants defined in {@link NPOI.ss.usermodel.ShapeTypes}.
@return the shape type
@see NPOI.ss.usermodel.ShapeTypes
Sets the shape types.
@param type the shape type, one of the constants defined in {@link NPOI.ss.usermodel.ShapeTypes}.
@see NPOI.ss.usermodel.ShapeTypes
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt to
org.openxmlformats.schemas.drawingml.x2006.main.CTFont adapter
This class : the Table Part (Open Office XML Part 4:
chapter 3.5.1)
This implementation works under the assumption that a table Contains mappings to a subtree of an XML.
The root element of this subtree an occur multiple times (one for each row of the table). The child nodes
of the root element can be only attributes or element with maxOccurs=1 property set
@author Roberto Manicardi
Checks if this Table element Contains even a single mapping to the map identified by id
@param id the XSSFMap ID
@return true if the Table element contain mappings
Calculates the xpath of the root element for the table. This will be the common part
of all the mapping's xpaths
@return the xpath of the table's root element
@return The reference for the cell in the top-left part of the table
(see Open Office XML Part 4: chapter 3.5.1.2, attribute ref)
@return The reference for the cell in the bottom-right part of the table
(see Open Office XML Part 4: chapter 3.5.1.2, attribute ref)
Synchronize table headers with cell values in the parent sheet.
Headers must be in sync, otherwise Excel will display a
"Found unreadable content" message on startup.
@return the name of the Table, if set
@return the display name of the Table, if set
@return the number of mapped table columns (see Open Office XML Part 4: chapter 3.5.1.4)
@return the total number of rows in the selection. (Note: in this version autofiltering is ignored)
Represents a text box in a SpreadsheetML Drawing.
@author Yegor Kozlov
Represents a SpreadsheetML VML Drawing.
In Excel 2007 VML Drawings are used to describe properties of cell comments,
although the spec says that VML is deprecated:
The VML format is a legacy format originally introduced with Office 2000 and is included and fully defined
in this Standard for backwards compatibility reasons. The DrawingML format is a newer and richer format
Created with the goal of eventually replacing any uses of VML in the Office Open XML formats. VML should be
considered a deprecated format included in Office Open XML for legacy reasons only and new applications that
need a file format for Drawings are strongly encouraged to use preferentially DrawingML
Warning - Excel is known to Put invalid XML into these files!
For example, >br< without being closed or escaped crops up.
See 6.4 VML - SpreadsheetML Drawing in Office Open XML Part 4 - Markup Language Reference.pdf
@author Yegor Kozlov
regexp to parse shape ids, in VML they have weird form of id="_x0000_s1026"
Create a new SpreadsheetML Drawing
@see XSSFSheet#CreateDrawingPatriarch()
Construct a SpreadsheetML Drawing from a namespace part
@param part the namespace part holding the Drawing data,
the content type must be application/vnd.Openxmlformats-officedocument.Drawing+xml
@param rel the namespace relationship holding this Drawing,
the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/drawing
Initialize a new Speadsheet VML Drawing
Find a shape with ClientData of type "NOTE" and the specified row and column
@return the comment shape or null
High level representation of a SpreadsheetML workbook. This is the first object most users
will construct whether they are Reading or writing a workbook. It is also the
top level object for creating new sheets/etc.
Width of one character of the default font in pixels. Same for Calibry and Arial.
Excel silently tRuncates long sheet names to 31 chars.
This constant is used to ensure uniqueness in the first 31 chars
Extended windows meta file
Windows Meta File
Mac PICT format
JPEG format
PNG format
Device independent bitmap
Images formats supported by XSSF but not by HSSF
The underlying XML bean
this holds the XSSFSheet objects attached to this workbook
this holds the XSSFName objects attached to this workbook
shared string table - a cache of strings in this workbook
A collection of shared objects used for styling content,
e.g. fonts, cell styles, colors, etc.
The locator of user-defined functions.
By default includes functions from the Excel Analysis Toolpack
TODO
A collection of custom XML mappings
Used to keep track of the data formatter so that all
CreateDataFormatter calls return the same one for a given
book. This ensures that updates from one places is visible
someplace else.
The policy to apply in the event of missing or
blank cells when fetching from a row.
See {@link NPOI.ss.usermodel.Row.MissingCellPolicy}
array of pictures for this workbook
cached instance of XSSFCreationHelper for this workbook
@see {@link #getCreationHelper()}
Create a new SpreadsheetML workbook.
Constructs a XSSFWorkbook object given a OpenXML4J Package
object,
see http://poi.apache.org/oxml4j/.
Once you have finished working with the Workbook, you should close the package
by calling pkg.close, to avoid leaving file handles open.
Creating a XSSFWorkbook from a file-backed OPC Package has a lower memory
footprint than an InputStream backed one.
@param pkg the OpenXML4J OPC Package
object.
Constructs a XSSFWorkbook object, by buffering the whole stream into memory
and then opening an {@link OPCPackage} object for it.
Using an {@link InputStream} requires more memory than using a File, so
if a {@link File} is available then you should instead do something like
OPCPackage pkg = OPCPackage.open(path);
XSSFWorkbook wb = new XSSFWorkbook(pkg);
// work with the wb object
......
pkg.close(); // gracefully closes the underlying zip file
Create a new CT_Workbook with all values Set to default
Create a new SpreadsheetML namespace and Setup the default minimal content
Return the underlying XML bean
@return the underlying CT_Workbook bean
Adds a picture to the workbook.
@param pictureData The bytes of the picture
@param format The format of the picture.
@return the index to this picture (0 based), the Added picture can be obtained from {@link #getAllPictures()} .
@see Workbook#PICTURE_TYPE_EMF
@see Workbook#PICTURE_TYPE_WMF
@see Workbook#PICTURE_TYPE_PICT
@see Workbook#PICTURE_TYPE_JPEG
@see Workbook#PICTURE_TYPE_PNG
@see Workbook#PICTURE_TYPE_DIB
@see #getAllPictures()
Adds a picture to the workbook.
@param is The sream to read image from
@param format The format of the picture.
@return the index to this picture (0 based), the Added picture can be obtained from {@link #getAllPictures()} .
@see Workbook#PICTURE_TYPE_EMF
@see Workbook#PICTURE_TYPE_WMF
@see Workbook#PICTURE_TYPE_PICT
@see Workbook#PICTURE_TYPE_JPEG
@see Workbook#PICTURE_TYPE_PNG
@see Workbook#PICTURE_TYPE_DIB
@see #getAllPictures()
Create an XSSFSheet from an existing sheet in the XSSFWorkbook.
The Cloned sheet is a deep copy of the original.
@return XSSFSheet representing the Cloned sheet.
@throws ArgumentException if the sheet index in invalid
@throws POIXMLException if there were errors when cloning
Create a new XSSFCellStyle and add it to the workbook's style table
@return the new XSSFCellStyle object
Returns the instance of XSSFDataFormat for this workbook.
@return the XSSFDataFormat object
@see NPOI.ss.usermodel.DataFormat
Create a new Font and add it to the workbook's font table
@return new font object
Create an XSSFSheet for this workbook, Adds it to the sheets and returns
the high level representation. Use this to create new sheets.
@return XSSFSheet representing the new sheet.
Create a new sheet for this Workbook and return the high level representation.
Use this to create new sheets.
Note that Excel allows sheet names up to 31 chars in length but other applications
(such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars,
others - tRuncate such names to 31 character.
POI's SpreadsheetAPI silently tRuncates the input argument to 31 characters.
Example:
Sheet sheet = workbook.CreateSheet("My very long sheet name which is longer than 31 chars"); // will be tRuncated
assert 31 == sheet.SheetName.Length;
assert "My very long sheet name which i" == sheet.SheetName;
Except the 31-character constraint, Excel applies some other rules:
Sheet name MUST be unique in the workbook and MUST NOT contain the any of the following characters:
- 0x0000
- 0x0003
- colon (:)
- backslash (\)
- asterisk (*)
- question mark (?)
- forward slash (/)
- opening square bracket ([)
- closing square bracket (])
The string MUST NOT begin or end with the single quote (') character.
See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)}
for a safe way to create valid names
@param sheetname sheetname to set for the sheet.
@return Sheet representing the new sheet.
@throws IllegalArgumentException if the name is null or invalid
or workbook already contains a sheet with this name
@see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)
Finds a font that matches the one with the supplied attributes
Gets all pictures from the Workbook.
@return the list of pictures (a list of {@link XSSFPictureData} objects.)
@see #AddPicture(byte[], int)
Get the cell style object at the given index
@param idx index within the Set of styles
@return XSSFCellStyle object at the index
Get the font at the given index number
@param idx index number
@return XSSFFont at the index
Gets the named range index by his name
Note:Excel named ranges are case-insensitive and
this method performs a case-insensitive search.
@param name named range name
@return named range index
Retrieves the reference for the printarea of the specified sheet, the sheet name is Appended to the reference even if it was not specified.
@param sheetIndex Zero-based sheet index (0 Represents the first sheet to keep consistent with java)
@return String Null if no print area has been defined
Get sheet with the given name (case insensitive match)
@param name of the sheet
@return XSSFSheet with the name provided or null
if it does not exist
Returns the index of the given sheet
@param sheet the sheet to look up
@return index of the sheet (0 based). -1 if not found
Get the sheet name
@param sheetIx Number
@return Sheet name
Allows foreach loops:
XSSFWorkbook wb = new XSSFWorkbook(package);
for(XSSFSheet sheet : wb){
}
Are we a normal workbook (.xlsx), or a
macro enabled workbook (.xlsm)?
As {@link #removeName(String)} is not necessarily unique
(name + sheet index is unique), this method is more accurate.
@param name the name to remove.
Delete the printarea for the sheet specified
@param sheetIndex 0-based sheet index (0 = First Sheet)
Removes sheet at the given index.
Care must be taken if the Removed sheet is the currently active or only selected sheet in
the workbook. There are a few situations when Excel must have a selection and/or active
sheet. (For example when printing - see Bug 40414).
This method Makes sure that if the Removed sheet was active, another sheet will become
active in its place. Furthermore, if the Removed sheet was the only selected sheet, another
sheet will become selected. The newly active/selected sheet will have the same index, or
one less if the Removed sheet was the last in the workbook.
@param index of the sheet (0-based)
Gracefully remove references to the sheet being deleted
@param index the 0-based index of the sheet to delete
Validate sheet index
@param index the index to validate
@throws ArgumentException if the index is out of range (index
< 0 || index >= NumberOfSheets).
For the Convenience of Java Programmers maintaining pointers.
@see #setPrintArea(int, String)
@param sheetIndex Zero-based sheet index (0 = First Sheet)
@param startColumn Column to begin printarea
@param endColumn Column to end the printarea
@param startRow Row to begin the printarea
@param endRow Row to end the printarea
Sets the repeating rows and columns for a sheet.
To Set just repeating columns:
workbook.SetRepeatingRowsAndColumns(0,0,1,-1,-1);
To Set just repeating rows:
workbook.SetRepeatingRowsAndColumns(0,-1,-1,0,4);
To remove all repeating rows and columns for a sheet.
workbook.SetRepeatingRowsAndColumns(0,-1,-1,-1,-1);
@param sheetIndex 0 based index to sheet.
@param startColumn 0 based start of repeating columns.
@param endColumn 0 based end of repeating columns.
@param startRow 0 based start of repeating rows.
@param endRow 0 based end of repeating rows.
Generates a NameRecord to represent a built-in region
@return a new NameRecord
@throws ArgumentException if sheetNumber is invalid
@throws POIXMLException if such a name already exists in the workbook
We only Set one sheet as selected for compatibility with HSSF.
Set the sheet name.
@param sheetIndex sheet number (0 based)
@param sheetname the new sheet name
@throws ArgumentException if the name is null or invalid
or workbook already Contains a sheet with this name
@see {@link #CreateSheet(String)}
@see {@link NPOI.ss.util.WorkbookUtil#CreateSafeSheetName(String nameProposal)}
for a safe way to create valid names
Sets the order of appearance for a given sheet.
@param sheetname the name of the sheet to reorder
@param pos the position that we want to insert the sheet into (0 based)
marshal named ranges from the {@link #namedRanges} collection to the underlying CT_Workbook bean
Returns SharedStringsTable - tha cache of string for this workbook
@return the shared string table
Return a object representing a collection of shared objects used for styling content,
e.g. fonts, cell styles, colors, etc.
Returns the Theme of current workbook.
Returns an object that handles instantiating concrete
classes of the various instances for XSSF.
Determines whether a workbook Contains the provided sheet name.
For the purpose of comparison, long names are tRuncated to 31 chars.
@param name the name to Test (case insensitive match)
@param excludeSheetIdx the sheet to exclude from the check or -1 to include all sheets in the Check.
@return true if the sheet Contains the name, false otherwise.
Gets a bool value that indicates whether the date systems used in the workbook starts in 1904.
The default value is false, meaning that the workbook uses the 1900 date system,
where 1/1/1900 is the first day in the system..
@return true if the date systems used in the workbook starts in 1904
Get the document's embedded files.
Check whether a sheet is hidden.
Note that a sheet could instead be Set to be very hidden, which is different
({@link #isSheetVeryHidden(int)})
@param sheetIx Number
@return true
if sheet is hidden
Check whether a sheet is very hidden.
This is different from the normal hidden status
({@link #isSheetHidden(int)})
@param sheetIx sheet index to check
@return true
if sheet is very hidden
Sets the visible state of this sheet.
Calling setSheetHidden(sheetIndex, true)
is equivalent to
setSheetHidden(sheetIndex, Workbook.SHEET_STATE_HIDDEN)
.
Calling setSheetHidden(sheetIndex, false)
is equivalent to
setSheetHidden(sheetIndex, Workbook.SHEET_STATE_VISIBLE)
.
@param sheetIx the 0-based index of the sheet
@param hidden whether this sheet is hidden
@see #setSheetHidden(int, int)
Hide or unhide a sheet.
- 0 - visible.
- 1 - hidden.
- 2 - very hidden.
@param sheetIx the sheet index (0-based)
@param state one of the following Workbook
constants:
Workbook.SHEET_STATE_VISIBLE
,
Workbook.SHEET_STATE_HIDDEN
, or
Workbook.SHEET_STATE_VERY_HIDDEN
.
@throws ArgumentException if the supplied sheet index or state is invalid
Hide or unhide a sheet.
The sheet number
0 for not hidden, 1 for hidden, 2 for very hidden
Fired when a formula is deleted from this workbook,
for example when calling cell.SetCellFormula(null)
@see XSSFCell#setCellFormula(String)
Return the CalculationChain object for this workbook
The calculation chain object specifies the order in which the cells in a workbook were last calculated
@return the CalculationChain
object or null
if not defined
@return a collection of custom XML mappings defined in this workbook
@return the helper class used to query the custom XML mapping defined in this workbook
Specifies a bool value that indicates whether structure of workbook is locked.
A value true indicates the structure of the workbook is locked. Worksheets in the workbook can't be Moved,
deleted, hidden, unhidden, or Renamed, and new worksheets can't be inserted.
A value of false indicates the structure of the workbook is not locked.
@return true if structure of workbook is locked
Specifies a bool value that indicates whether the windows that comprise the workbook are locked.
A value of true indicates the workbook windows are locked. Windows are the same size and position each time the
workbook is opened.
A value of false indicates the workbook windows are not locked.
@return true if windows that comprise the workbook are locked
Specifies a bool value that indicates whether the workbook is locked for revisions.
@return true if the workbook is locked for revisions.
Locks the structure of workbook.
Unlocks the structure of workbook.
Locks the windows that comprise the workbook.
Unlocks the windows that comprise the workbook.
Locks the workbook for revisions.
Unlocks the workbook for revisions.
Returns the locator of user-defined functions.
The default instance : the built-in functions with the Excel Analysis Tool Pack.
To Set / Evaluate custom functions you need to register them as follows:
@return wrapped instance of UDFFinder that allows seeking functions both by index and name
Register a new toolpack in this workbook.
@param toopack the toolpack to register
Whether the application shall perform a full recalculation when the workbook is opened.
Typically you want to force formula recalculation when you modify cell formulas or values
of a workbook previously Created by Excel. When Set to true, this flag will tell Excel
that it needs to recalculate all formulas in the workbook the next time the file is opened.
Note, that recalculation updates cached formula results and, thus, modifies the workbook.
Depending on the version, Excel may prompt you with "Do you want to save the Changes in filename?"
on close.
@param value true if the application will perform a full recalculation of
workbook values when the workbook is opened
@since 3.8
Whether Excel will be asked to recalculate all formulas when the workbook is opened.
@since 3.8
Convenience method to Get the active sheet. The active sheet is is the sheet
which is currently displayed when the workbook is viewed in Excel.
'Selected' sheet(s) is a distinct concept.
Get the number of styles the workbook Contains
@return count of cell styles
Get the number of fonts in the this workbook
@return number of fonts
Get the number of named ranges in the this workbook
@return number of named ranges
Get the number of worksheets in the this workbook
@return number of worksheets
Retrieves the current policy on what to do when
Getting missing or blank cells from a row.
The default is to return blank and null cells.
{@link MissingCellPolicy}
Gets the first tab that is displayed in the list of tabs in excel.
@return integer that Contains the index to the active sheet in this book view.
This is a seriously sick fix for the fact that some .xlsx
files contain raw bits of HTML, without being escaped
or properly turned into XML.
The result is that they contain things like >br<,
which breaks the XML parsing.
This very sick InputStream wrapper attempts to spot
these go past, and fix them.
Only works for UTF-8 and US-ASCII based streams!
It should only be used where experience Shows the problem
can occur...
Warning - doesn't fix!
Reads into the buffer from the spare bytes
Helper class to extract text from an OOXML Word file
Should we also fetch the hyperlinks, when fetching
the text content? Default is to only output the
hyperlink label, and not the contents
Base class for XWPF paragraphs
@author Yury Batrakov (batrakov at gmail.com)
Decorator class for XWPFParagraph allowing to add comments
found in paragraph to its text
@author Yury Batrakov (batrakov at gmail.com)
Base decorator class for XWPFParagraph
A .docx file can have no headers/footers, the same header/footer
on each page, odd/even page footers, and optionally also
a different header/footer on the first page.
This class handles sorting out what there is, and giving you
the right headers and footers for the document.
Figures out the policy for the given document,
and Creates any header and footer objects
as required.
Figures out the policy for the given document,
and Creates any header and footer objects
as required.
MB 24 May 2010. Created this overloaded buildHdrFtr() method because testing demonstrated
that the XWPFFooter or XWPFHeader object returned by calls to the CreateHeader(int, XWPFParagraph[])
and CreateFooter(int, XWPFParagraph[]) methods or the GetXXXXXHeader/Footer methods where
headers or footers had been Added to a document since it had been Created/opened, returned
an object that Contained no XWPFParagraph objects even if the header/footer itself did contain
text. The reason was that this line of code; CTHdrFtr ftr = CTHdrFtr.Factory.NewInstance();
Created a brand new instance of the CTHDRFtr class which was then populated with data when
it should have recovered the CTHdrFtr object encapsulated within the XWPFHeaderFooter object
that had previoulsy been instantiated in the CreateHeader(int, XWPFParagraph[]) or
CreateFooter(int, XWPFParagraph[]) methods.
Returns the odd page header. This is
also the same as the default one...
Returns the odd page footer. This is
also the same as the default one...
Get the header that applies to the given
(1 based) page.
@param pageNumber The one based page number
Get the footer that applies to the given
(1 based) page.
@param pageNumber The one based page number
Decorator class for XWPFParagraph allowing to add hyperlinks
found in paragraph to its text.
Note - Adds the hyperlink at the end, not in the right place...
@deprecated Use {@link XWPFHyperlinkRun} instead
@param nextDecorator The next decorator to use
@param outputHyperlinkUrls Should we output the links too, or just the link text?
@param prgrph The paragraph of text to work on
@param outputHyperlinkUrls Should we output the links too, or just the link text?
9 Jan 2010
// TODO insert Javadoc here!
@author epp
9 Jan 2010
// TODO insert Javadoc here!
@author epp
Specifies all types of borders which can be specified for WordProcessingML
objects which have a border. Borders can be Separated into two types:
- Line borders: which specify a pattern to be used when Drawing a line around the
specified object.
- Art borders: which specify a repeated image to be used
when Drawing a border around the specified object. Line borders may be
specified on any object which allows a border, however, art borders may only
be used as a border at the page level - the borders under the pgBorders
element
@author Gisella Bronzetti
Specifies a line border consisting of a single line around the parent
object.
Specifies an art border consisting of a repeated image of an apple
Specifies an art border consisting of a repeated image of a shell pattern
Specifies an art border consisting of a repeated image of a baby pacifier
Specifies an art border consisting of a repeated image of a baby rattle
Specifies an art border consisting of a repeated image of a Set of
balloons
Specifies an art border consisting of a repeated image of a hot air
balloon
Specifies an art border consisting of a repeating image of a black and
white background.
Specifies an art border consisting of a repeating image of a black dot on
a white background.
Specifies an art border consisting of a repeating image of a black and
white background
Specifies an art border consisting of a repeating image of a black and
white background.
Specifies an art border consisting of a repeating image of a black and
white background.
Specifies an art border consisting of a repeating image of a white dot on
a black background.
Specifies an art border consisting of a repeating image of a black and
white background.
Specifies an art border consisting of a repeating image of a black and
white background.
Specifies an art border consisting of a repeating image of a black and
white background
Specifies an art border consisting of a repeating image of a black and
white background
Specifies an art border consisting of a repeated image of bats
Specifies an art border consisting of repeating images of birds
Specifies an art border consisting of a repeated image of birds flying
Specifies an art border consisting of a repeated image of a cabin
Specifies an art border consisting of a repeated image of a piece of cake
Specifies an art border consisting of a repeated image of candy corn
Specifies an art border consisting of a repeated image of a knot work
pattern
Specifies an art border consisting of a banner.
If the border is on the left or right, no border is displayed.
Specifies an art border consisting of a repeating image of a chain link
pattern.
Specifies an art border consisting of a repeated image of a champagne
bottle
Specifies an art border consisting of repeating images of a compass
Specifies an art border consisting of a repeating image of a colored
pattern.
Specifies an art border consisting of a repeated image of a Checkerboard
Specifies an art border consisting of a repeated image of a Christmas
tree
Specifies an art border consisting of repeating images of lines and
circles
Specifies an art border consisting of a repeated image of a rectangular
pattern
Specifies an art border consisting of a repeated image of a wave
Specifies an art border consisting of a repeated image of a clock
Specifies an art border consisting of repeating images of a compass
Specifies an art border consisting of a repeated image of confetti
Specifies an art border consisting of a repeated image of confetti
Specifies an art border consisting of a repeated image of confetti
Specifies an art border consisting of a repeated image of confetti
streamers
Specifies an art border consisting of a repeated image of confetti
Specifies an art border consisting of a repeated image
Specifies an art border consisting of a dashed line
Specifies an art border consisting of a dotted line
Specifies an art border consisting of a repeated image of a maze-like
pattern
Specifies an art border consisting of a repeated image of a butterfly
Specifies an art border consisting of a repeated image of a fish
Specifies an art border consisting of repeating images of insects.
Specifies an art border consisting of a repeated image of a ladybug
Specifies an art border consisting of repeating images of a cross-stitch
pattern
Specifies an art border consisting of a repeated image of Cupid
Specifies the Set of possible restart locations which may be used as to
determine the next available line when a break's type attribute has a value
of textWrapping.
@author Gisella Bronzetti
Specifies that the text wrapping break shall advance the text to the next
line in the WordProcessingML document, regardless of its position left to
right or the presence of any floating objects which intersect with the
line,
This is the Setting for a typical line break in a document.
Specifies that the text wrapping break shall behave as follows:
- If this line is broken into multiple regions (a floating object in
the center of the page has text wrapping on both sides:
- If this is the leftmost region of text flow on this line, advance
the text to the next position on the line
- Otherwise, treat this as a text wrapping break of type all.
- If this line is not broken into multiple regions, then treat this
break as a text wrapping break of type none.
If the parent paragraph is right to left, then these behaviors are
also reversed.
Specifies that the text wrapping break shall advance the text to the next
line in the WordProcessingML document which spans the full width of the
line.
Specifies the possible types of break characters in a WordProcessingML
document.
The break type determines the next location where text shall be
placed After this manual break is applied to the text contents
@author Gisella Bronzetti
Specifies that the current break shall restart itself on the next page of
the document when the document is displayed in page view.
Specifies that the current break shall restart itself on the next column
available on the current page when the document is displayed in page
view.
If the current section is not divided into columns, or the column break
occurs in the last column on the current page when displayed, then the
restart location for text shall be the next page in the document.
Specifies that the current break shall restart itself on the next line in
the document when the document is displayed in page view.
The determine of the next line shall be done subject to the value of the clear
attribute on the specified break character.
Extended windows meta file
Windows Meta File
Mac PICT format
JPEG format
PNG format
Device independent bitmap
GIF image format
Tag Image File (.tiff)
Encapsulated Postscript (.eps)
Windows Bitmap (.bmp)
WordPerfect graphics (.wpg)
8 Jan 2010
// This Interface represents an object, which is able to have a collection of paragraphs and tables
this can be XWFPDocument, XWPFHeader, XWPFFooter, XWPFTableCell
@author Philipp Epp
returns the Part, to which the body belongs, which you need for Adding relationship to other parts
Actually it is needed of the class XWPFTableCell. Because you have to know to which part the tableCell
belongs.
@return the Part, to which the body belongs
if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this header or footer
the method will return this paragraph
if there is no corresponding {@link XWPFParagraph} the method will return null
@param p is instance of CTP and is searching for an XWPFParagraph
@return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer
XWPFParagraph with the correspondig CTP p
if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header
the method will return this table
if there is no corresponding {@link XWPFTable} the method will return null
@param ctTable
Returns the paragraph that of position pos
Returns the table at position pos
inserts a new paragraph at position of the cursor
@param cursor
inserts a new Table at the cursor position.
@param cursor
inserts a new Table at position pos
@param pos
@param table
returns the TableCell to which the Table belongs
@param cell
Return XWPFDocument
Get the PartType of the body, for example
DOCUMENT, HEADER, FOOTER, FOOTNOTE,
@return the PartType of the body
Returns an Iterator with paragraphs and tables,
in the order that they occur in the text.
Returns the paragraph(s) that holds
the text of the header or footer.
Return the table(s) that holds the text
of the IBodyPart, for complex cases
where a paragraph isn't used.
9 Jan 2010
@author Philipp Epp
Specifies the logic which shall be used to calculate the line spacing of the
parent object when it is displayed in the document.
@author Gisella Bronzetti
Specifies that the line spacing of the parent object shall be
automatically determined by the size of its contents, with no
predetermined minimum or maximum size.
Specifies that the height of the line shall be exactly the value
specified, regardless of the size of the contents If the contents are too
large for the specified height, then they shall be clipped as necessary.
Specifies that the height of the line shall be at least the value
specified, but may be expanded to fit its content as needed.
Specifies all types of alignment which are available to be applied to objects in a
WordProcessingML document
@author Yegor Kozlov
* postion of a character in a paragrapho
* 1st RunPositon
* 2nd TextPosition
* 3rd CharacterPosition
*
*
Specifies all types of vertical alignment which are available to be applied to of all text
on each line displayed within a paragraph.
@author Gisella Bronzetti
Specifies that all text in the parent object shall be
aligned to the top of each character when displayed
Specifies that all text in the parent object shall be
aligned to the center of each character when displayed.
Specifies that all text in the parent object shall be
aligned to the baseline of each character when displayed.
Specifies that all text in the parent object shall be
aligned to the bottom of each character when displayed.
Specifies that all text in the parent object shall be
aligned automatically when displayed.
saves the begin and end position of a text in a Paragraph
Specifies the types of patterns which may be used to create the underline
applied beneath the text in a Run.
@author Gisella Bronzetti
Specifies an underline consisting of a single line beneath all characters
in this Run.
Specifies an underline consisting of a single line beneath all non-space
characters in the Run. There shall be no underline beneath any space
character (breaking or non-breaking).
Specifies an underline consisting of two lines beneath all characters in
this run
Specifies an underline consisting of a single thick line beneath all
characters in this Run.
Specifies an underline consisting of a series of dot characters beneath
all characters in this Run.
Specifies an underline consisting of a series of thick dot characters
beneath all characters in this Run.
Specifies an underline consisting of a dashed line beneath all characters
in this Run.
Specifies an underline consisting of a series of thick dashes beneath all
characters in this Run.
Specifies an underline consisting of long dashed characters beneath all
characters in this Run.
Specifies an underline consisting of thick long dashed characters beneath
all characters in this Run.
Specifies an underline consisting of a series of dash, dot characters
beneath all characters in this Run.
Specifies an underline consisting of a series of thick dash, dot
characters beneath all characters in this Run.
Specifies an underline consisting of a series of dash, dot, dot
characters beneath all characters in this Run.
Specifies an underline consisting of a series of thick dash, dot, dot
characters beneath all characters in this Run.
Specifies an underline consisting of a single wavy line beneath all
characters in this Run.
Specifies an underline consisting of a single thick wavy line beneath all
characters in this Run.
Specifies an underline consisting of a pair of wavy lines beneath all
characters in this Run.
Specifies no underline beneath this Run.
Specifies possible values for the alignment of the contents of this run in
relation to the default appearance of the Run's text. This allows the text to
be repositioned as subscript or superscript without altering the font size of
the run properties.
@author Gisella Bronzetti
Specifies that the text in the parent run shall be located at the
baseline and presented in the same size as surrounding text.
Specifies that this text should be subscript. This Setting shall lower
the text in this run below the baseline and change it to a smaller size,
if a smaller size is available.
Specifies that this text should be superscript. This Setting shall raise
the text in this run above the baseline and change it to a smaller size,
if a smaller size is available.
@author Philipp Epp
Abstract Numbering Definition Type
Numbering Definition Type
Single Level Numbering Definition
Multilevel Numbering Definition
Hybrid Multilevel Numbering Definition
Numbering Format
Decimal Numbers
Uppercase Roman Numerals
Lowercase Roman Numerals
Uppercase Latin Alphabet
Lowercase Latin Alphabet
Ordinal
Cardinal Text
Ordinal Text
Hexadecimal Numbering
Chicago Manual of Style
Ideographs
Japanese Counting System
AIUEO Order Hiragana
Iroha Ordered Katakana
Double Byte Arabic Numerals
Single Byte Arabic Numerals
Japanese Legal Numbering
Japanese Digital Ten Thousand Counting System
Decimal Numbers Enclosed in a Circle
Double Byte Arabic Numerals Alternate
Full-Width AIUEO Order Hiragana
Full-Width Iroha Ordered Katakana
Initial Zero Arabic Numerals
Bullet
Korean Ganada Numbering
Korean Chosung Numbering
Decimal Numbers Followed by a Period
Decimal Numbers Enclosed in Parenthesis
Decimal Numbers Enclosed in a Circle
Ideographs Enclosed in a Circle
Traditional Ideograph Format
Zodiac Ideograph Format
Traditional Zodiac Ideograph Format
Taiwanese Counting System
Traditional Legal Ideograph Format
Taiwanese Counting Thousand System
Taiwanese Digital Counting System
Chinese Counting System
Chinese Legal Simplified Format
Chinese Counting Thousand System
Korean Digital Counting System
Korean Counting System
Korean Legal Numbering
Korean Digital Counting System Alternate
Vietnamese Numerals
Lowercase Russian Alphabet
Uppercase Russian Alphabet
No Numbering
Number With Dashes
Hebrew Numerals
Hebrew Alphabet
Arabic Alphabet
Arabic Abjad Numerals
Hindi Vowels
Hindi Consonants
Hindi Numbers
Hindi Counting System
Thai Letters
Thai Numerals
Thai Counting System
* Sketch of XWPF comment class
*
* @author Yury Batrakov (batrakov at gmail.com)
*
Experimental class to do low level Processing
of docx files.
If you're using these low level classes, then you
will almost certainly need to refer to the OOXML
specifications from
http://www.ecma-international.org/publications/standards/Ecma-376.htm
WARNING - APIs expected to change rapidly
Keeps track on all id-values used in this document and included parts, like headers, footers, etc.
Handles the joy of different headers/footers for different pages
Create a new WordProcessingML package and Setup the default minimal content
Create a new CT_Document with all values Set to default
@see NPOI.XWPF.UserModel.IBody#getTableArray(int)
Get the document part that's defined as the
given relationship of the core document.
Returns the policy on headers and footers, which
also provides a way to Get at them.
Returns the styles object used
Get the document's embedded files.
Finds that for example the 2nd entry in the body list is the 1st paragraph
Look up the paragraph at the specified position in the body elemnts list
and return this paragraphs position in the paragraphs list
@param pos
The position of the relevant paragraph in the body elements
list
@return the position of the paragraph in the paragraphs list, if there is
a paragraph at the position in the bodyelements list. Else it
will return -1
Get with the position of a table in the bodyelement array list
the position of this table in the table array list
@param pos position of the table in the bodyelement array list
@return if there is a table at the position in the bodyelement array list,
else it will return null.
Add a new paragraph at position of the cursor. The cursor must be on the
{@link org.apache.xmlbeans.XmlCursor.TokenType#START} tag of an subelement
of the documents body. When this method is done, the cursor passed as
parameter points to the {@link org.apache.xmlbeans.XmlCursor.TokenType#END}
of the newly inserted paragraph.
@param cursor
@return the {@link XWPFParagraph} object representing the newly inserted
CTP object
verifies that cursor is on the right position
@param cursor
Get the position of the paragraph, within the list
of all the body elements.
@param p The paragraph to find
@return The location, or -1 if the paragraph couldn't be found
Get the position of the table, within the list of
all the body elements.
@param t The table to find
@return The location, or -1 if the table couldn't be found
Commit and saves the document
Gets the index of the relation we're trying to create
@param relation
@return i
Appends a new paragraph to this document
@return a new paragraph
Creates an empty numbering if one does not already exist and Sets the numbering member
@return numbering
Creates an empty styles for the document if one does not already exist
@return styles
Creates an empty footnotes element for the document if one does not already exist
@return footnotes
remove a BodyElement from bodyElements array list
@param pos
@return true if removing was successfully, else return false
copies content of a paragraph to a existing paragraph in the list paragraphs at position pos
@param paragraph
@param pos
@return the LastParagraph of the document
Create an empty table with one row and one column as default.
@return a new table
Create an empty table with a number of rows and cols specified
@param rows
@param cols
@return table
Replace content of table in array tables at position pos with a
@param pos
@param table
Verifies that the documentProtection tag in Settings.xml file
specifies that the protection is enforced (w:enforcement="1")
and that the kind of protection is ReadOnly (w:edit="readOnly")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="readOnly" w:enforcement="1"/>
@return true if documentProtection is enforced with option ReadOnly
Verifies that the documentProtection tag in Settings.xml file
specifies that the protection is enforced (w:enforcement="1")
and that the kind of protection is forms (w:edit="forms")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="forms" w:enforcement="1"/>
@return true if documentProtection is enforced with option forms
Verifies that the documentProtection tag in Settings.xml file
specifies that the protection is enforced (w:enforcement="1")
and that the kind of protection is comments (w:edit="comments")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="comments" w:enforcement="1"/>
@return true if documentProtection is enforced with option comments
Verifies that the documentProtection tag in Settings.xml file
specifies that the protection is enforced (w:enforcement="1")
and that the kind of protection is trackedChanges (w:edit="trackedChanges")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="trackedChanges" w:enforcement="1"/>
@return true if documentProtection is enforced with option trackedChanges
Enforces the ReadOnly protection.
In the documentProtection tag inside Settings.xml file,
it Sets the value of enforcement to "1" (w:enforcement="1")
and the value of edit to ReadOnly (w:edit="readOnly")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="readOnly" w:enforcement="1"/>
Enforce the Filling Forms protection.
In the documentProtection tag inside Settings.xml file,
it Sets the value of enforcement to "1" (w:enforcement="1")
and the value of edit to forms (w:edit="forms")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="forms" w:enforcement="1"/>
Enforce the Comments protection.
In the documentProtection tag inside Settings.xml file,
it Sets the value of enforcement to "1" (w:enforcement="1")
and the value of edit to comments (w:edit="comments")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="comments" w:enforcement="1"/>
Enforce the Tracked Changes protection.
In the documentProtection tag inside Settings.xml file,
it Sets the value of enforcement to "1" (w:enforcement="1")
and the value of edit to trackedChanges (w:edit="trackedChanges")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="trackedChanges" w:enforcement="1"/>
Remove protection enforcement.
In the documentProtection tag inside Settings.xml file
it Sets the value of enforcement to "0" (w:enforcement="0")
Enforces fields update on document open (in Word).
In the settings.xml file
sets the updateSettings value to true (w:updateSettings w:val="true")
NOTICES:
- Causing Word to ask on open: "This document contains fields that may refer to other files. Do you want to update the fields in this document?"
(if "Update automatic links at open" is enabled)
- Flag is removed after saving with changes in Word
inserts an existing XWPFTable to the arrays bodyElements and tables
@param pos
@param table
Get the next free ImageNumber
@param format
@return the next free ImageNumber
@throws InvalidFormatException
returns the PictureData by blipID
@param blipID
@return XWPFPictureData of a specificID
GetNumbering
@return numbering
Get Styles
@return styles for this document
Get the paragraph with the CTP class p
@param p
@return the paragraph with the CTP class p
Get a table by its CTTbl-Object
@param ctTbl
@see NPOI.XWPF.UserModel.IBody#getTable(org.Openxmlformats.schemas.wordProcessingml.x2006.main.CTTbl)
@return a table by its CTTbl-Object or null
Returns the paragraph that of position pos
@see NPOI.XWPF.UserModel.IBody#getParagraphArray(int)
returns the Part, to which the body belongs, which you need for Adding relationship to other parts
Actually it is needed of the class XWPFTableCell. Because you have to know to which part the tableCell
belongs.
@see NPOI.XWPF.UserModel.IBody#getPart()
Get the TableCell which belongs to the TableCell
@param cell
Returns the low level document base object
returns an Iterator with paragraphs and tables
@see NPOI.XWPF.UserModel.IBody#getBodyElements()
@see NPOI.XWPF.UserModel.IBody#getParagraphs()
@see NPOI.XWPF.UserModel.IBody#getTables()
@return the list of footers
@return the list of headers
Returns all Pictures, which are referenced from the document itself.
@return a {@link List} of {@link XWPFPictureData}. The returned {@link List} is unmodifiable. Use #a
@return all Pictures in this package
Get the PartType of the body, for example
DOCUMENT, HEADER, FOOTER, FOOTNOTE,
@see NPOI.XWPF.UserModel.IBody#getPartType()
@author Yegor Kozlov
Sketch of XWPF footer class
Parent of XWPF headers and footers
Set a new headerFooter
if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header
the method will return this table
if there is no corresponding {@link XWPFTable} the method will return null
@param ctTable
if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this header or footer
the method will return this paragraph
if there is no corresponding {@link XWPFParagraph} the method will return null
@param p is instance of CTP and is searching for an XWPFParagraph
@return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer
XWPFParagraph with the correspondig CTP p
Returns the paragraph that holds
the text of the header or footer.
Get a List of all Paragraphs
@return a list of {@link XWPFParagraph}
Adds a picture to the document.
@param pictureData The picture data
@param format The format of the picture.
@return the index to this picture (0 based), the Added picture can be obtained from {@link #getAllPictures()} .
@throws InvalidFormatException
Adds a picture to the document.
@param is The stream to read image from
@param format The format of the picture.
@return the index to this picture (0 based), the Added picture can be obtained from {@link #getAllPictures()} .
@throws InvalidFormatException
@
returns the PictureData by blipID
@param blipID
@return XWPFPictureData of a specificID
@throws Exception
Returns the table at position pos
@see NPOI.XWPF.UserModel.IBody#getTableArray(int)
inserts an existing XWPFTable to the arrays bodyElements and tables
@param pos
@param table
Get the TableCell which belongs to the TableCell
@param cell
returns the Part, to which the body belongs, which you need for Adding relationship to other parts
@see NPOI.XWPF.UserModel.IBody#getPart()
Returns the paragraph(s) that holds
the text of the header or footer.
Normally there is only the one paragraph, but
there could be more in certain cases, or
a table.
Return the table(s) that holds the text
of the header or footer, for complex cases
where a paragraph isn't used.
Normally there's just one paragraph, but some
complex headers/footers have a table or two
in Addition.
Returns the textual content of the header/footer,
by flattening out the text of its paragraph(s)
Get all Pictures in this package
@return all Pictures in this package
verifies that cursor is on the right position
@param cursor
save and Commit footer
Get the PartType of the body
@see NPOI.XWPF.UserModel.IBody#getPartType()
position in table array
The table at position pos
inserts an existing XWPFTable to the arrays bodyElements and tables
if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header
the method will return this table
if there is no corresponding {@link XWPFTable} the method will return null
@param ctTable
@see NPOI.XWPF.UserModel.IBody#getTable(CTTbl ctTable)
if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this header or footer
the method will return this paragraph
if there is no corresponding {@link XWPFParagraph} the method will return null
@param p is instance of CTP and is searching for an XWPFParagraph
@return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer
XWPFParagraph with the correspondig CTP p
@see NPOI.XWPF.UserModel.IBody#getParagraph(CTP p)
Returns the paragraph that holds the text of the header or footer.
Get the TableCell which belongs to the TableCell
verifies that cursor is on the right position
@param cursor
@param cursor
@return the inserted table
@see NPOI.XWPF.UserModel.IBody#insertNewTbl(XmlCursor cursor)
add a new paragraph at position of the cursor
@param cursor
@return the inserted paragraph
@see NPOI.XWPF.UserModel.IBody#insertNewParagraph(XmlCursor cursor)
add a new table to the end of the footnote
@param table
@return the Added XWPFTable
add a new paragraph to the end of the footnote
@param paragraph
@return the Added XWPFParagraph
@see NPOI.XWPF.UserModel.IBody#getXWPFDocument()
returns the Part, to which the body belongs, which you need for Adding relationship to other parts
@see NPOI.XWPF.UserModel.IBody#getPart()
Get the PartType of the body
@see NPOI.XWPF.UserModel.IBody#getPartType()
Looks After the collection of Footnotes for a document
@author Mike McEuen (mceuen@hp.com)
Construct XWPFFootnotes from a package part
@param part the package part holding the data of the footnotes,
@param rel the package relationship of type "http://schemas.Openxmlformats.org/officeDocument/2006/relationships/footnotes"
Construct XWPFFootnotes from scratch for a new document.
Read document
Sets the ctFootnotes
@param footnotes
add an XWPFFootnote to the document
@param footnote
@throws IOException
add a footnote to the document
@param note
@throws IOException
@see NPOI.XWPF.UserModel.IBody#getPart()
Sketch of XWPF header class
Save and commit footer
Read the document
Get the PartType of the body
* Sketch of XWPF hyperlink class
*
* @author Yury Batrakov (batrakov at gmail.com)
*
A run of text with a Hyperlink applied to it.
Any given Hyperlink may be made up of multiple of these.
XWPFrun.object defines a region of text with a common Set of properties
@author Yegor Kozlov
@author Gregg Morris (gregg dot morris at gmail dot com) - added getColor(), setColor()
@param r the CT_R bean which holds the run.attributes
@param p the parent paragraph
Get the currently used CT_R object
@return CT_R object
For isBold, isItalic etc
Whether the bold property shall be applied to all non-complex script
characters in the contents of this run.when displayed in a document.
This formatting property is a toggle property, which specifies that its
behavior differs between its use within a style defInition and its use as
direct formatting. When used as part of a style defInition, Setting this
property shall toggle the current state of that property as specified up
to this point in the hierarchy (i.e. applied to not applied, and vice
versa). Setting it to false
(or an equivalent) shall
result in the current Setting remaining unChanged. However, when used as
direct formatting, Setting this property to true or false shall Set the
absolute state of the resulting property.
If this element is not present, the default value is to leave the
formatting applied at previous level in the style hierarchy. If this
element is never applied in the style hierarchy, then bold shall not be
applied to non-complex script characters.
@param value true
if the bold property is applied to
this run
Get text color. The returned value is a string in the hex form "RRGGBB".
Set text color.
@param rgbStr - the desired color, in the hex form "RRGGBB".
Return the string content of this text run
@return the text of this text run.or null
if not Set
Sets the text of this text run
@param value the literal text which shall be displayed in the document
Sets the text of this text run.in the
@param value the literal text which shall be displayed in the document
@param pos - position in the text array (NB: 0 based)
This element specifies the amount by which text shall be raised or
lowered for this run.in relation to the default baseline of the
surrounding non-positioned text. This allows the text to be repositioned
without altering the font size of the contents.
@return a big integer representing the amount of text shall be "moved"
Specifies that a break shall be placed at the current location in the run
content.
A break is a special character which is used to override the
normal line breaking that would be performed based on the normal layout
of the document's contents.
@see #AddCarriageReturn()
Specifies that a break shall be placed at the current location in the run
content.
A break is a special character which is used to override the
normal line breaking that would be performed based on the normal layout
of the document's contents.
The behavior of this break character (the
location where text shall be restarted After this break) shall be
determined by its type values.
@see BreakType
Specifies that a break shall be placed at the current location in the run
content. A break is a special character which is used to override the
normal line breaking that would be performed based on the normal layout
of the document's contents.
The behavior of this break character (the
location where text shall be restarted After this break) shall be
determined by its type (in this case is BreakType.TEXT_WRAPPING as default) and clear attribute values.
@see BreakClear
Specifies that a carriage return shall be placed at the
current location in the run.content.
A carriage return is used to end the current line of text in
WordProcess.
The behavior of a carriage return in run.content shall be
identical to a break character with null type and clear attributes, which
shall end the current line and find the next available line on which to
continue.
The carriage return character forced the following text to be
restarted on the next available line in the document.
Adds a picture to the run. This method handles
attaching the picture data to the overall file.
@see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_EMF
@see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_WMF
@see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_PICT
@see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_JPEG
@see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_PNG
@see NPOI.XWPF.UserModel.Document#PICTURE_TYPE_DIB
@param pictureData The raw picture data
@param pictureType The type of the picture, eg {@link Document#PICTURE_TYPE_JPEG}
@param width width in EMUs. To convert to / from points use {@link org.apache.poi.util.Units}
@param height height in EMUs. To convert to / from points use {@link org.apache.poi.util.Units}
@throws NPOI.Openxml4j.exceptions.InvalidFormatException
@throws IOException
Returns the embedded pictures of the run. These
are pictures which reference an external,
embedded picture image such as a .png or .jpg
Add the xml:spaces="preserve" attribute if the string has leading or trailing white spaces
@param xs the string to check
Returns the string version of the text, with tabs and
carriage returns in place of their xml equivalents.
Get the currenty referenced paragraph object
@return current paragraph
@return The {@link XWPFDocument} instance, this run.belongs to, or
null
if parent structure (paragraph > document) is not properly Set.
Whether the bold property shall be applied to all non-complex script
characters in the contents of this run.when displayed in a document
@return true
if the bold property is applied
Returns text embedded in pictures
Whether the italic property should be applied to all non-complex script
characters in the contents of this run.when displayed in a document.
@return true
if the italic property is applied
Specifies that the contents of this run.should be displayed along with an
underline appearing directly below the character heigh
@return the Underline pattern Applyed to this run
@see UnderlinePatterns
Specifies that the contents of this run.shall be displayed with a single
horizontal line through the center of the line.
@return true
if the strike property is applied
Specifies the alignment which shall be applied to the contents of this
run.in relation to the default appearance of the run.s text.
This allows the text to be repositioned as subscript or superscript without
altering the font size of the run.properties.
@return VerticalAlign
@see VerticalAlign all possible value that could be Applyed to this run
Specifies the fonts which shall be used to display the text contents of
this run. Specifies a font which shall be used to format all characters
in the ASCII range (0 - 127) within the parent run
@return a string representing the font family
Specifies the font size which shall be applied to all non complex script
characters in the contents of this run.when displayed.
@return value representing the font size
Returns the ID of the hyperlink, if one is Set.
If this Hyperlink is an external reference hyperlink,
return the object for it.
Checks wheter specific LatentStyleID is a latentStyle
@author Philipp Epp
@author Philipp Epp
create a new styles object with an existing document
create a new XWPFNumbering object for use in a new document
read numbering form an existing package
save and Commit numbering
Sets the ctNumbering
@param numbering
Checks whether number with numID exists
@param numID
@return bool true if num exist, false if num not exist
add a new number to the numbering document
@param num
Add a new num with an abstractNumID
@return return NumId of the Added num
Add a new num with an abstractNumID and a numID
@param abstractNumID
@param numID
Get Num by NumID
@param numID
@return abstractNum with NumId if no Num exists with that NumID
null will be returned
Get AbstractNum by abstractNumID
@param abstractNumID
@return abstractNum with abstractNumId if no abstractNum exists with that abstractNumID
null will be returned
Compare AbstractNum with abstractNums of this numbering document.
If the content of abstractNum Equals with an abstractNum of the List in numbering
the Bigint Value of it will be returned.
If no equal abstractNum is existing null will be returned
@param abstractNum
@return Bigint
add a new AbstractNum and return its AbstractNumID
@param abstractNum
Add a new AbstractNum
@author antony liu
remove an existing abstractNum
@param abstractNumID
@return true if abstractNum with abstractNumID exists in NumberingArray,
false if abstractNum with abstractNumID not exists
return the abstractNumID
If the AbstractNumID not exists
return null
@param numID
@return abstractNumID
Sketch of XWPF paragraph class
For access to the document's hyperlink, comments, tables etc
Identifies (in order) the parts of the paragraph /
sub-paragraph that correspond to character text
runs, and builds the appropriate runs for these.
If style exist for this paragraph
NumId of the paragraph will be returned.
If style not exist null will be returned
@return NumID as Bigint
SetNumID of Paragraph
@param numPos
Set NumID and level of Paragraph
Appends a new run to this paragraph
a new text run
Get a copy of the currently used CTPBrd, if none is used, return
a new instance.
Get a copy of the currently used CTSpacing, if none is used,
return a new instance.
Get a copy of the currently used CTPInd, if none is used, return
a new instance.
Get a copy of the currently used CTPPr, if none is used, return
a new instance.
add a new run at the end of the position of
the content of parameter run
@param run
this methods parse the paragraph and search for the string searched.
If it finds the string, it will return true and the position of the String will be saved in the parameter startPos.
insert a new Run in RunArray
the inserted run
Get a Text
@param segment
Removes a Run at the position pos in the paragraph
@param pos
@return true if the run was Removed
returns the part of the bodyElement
@see NPOI.XWPF.UserModel.IBody#getPart()
Adds a new Run to the Paragraph
@param r
return the XWPFRun-Element which owns the CTR Run-Element
@param r
Return the textual content of the paragraph, including text from pictures
in it.
Return styleID of the paragraph if style exist for this paragraph
if not, null will be returned
@return styleID as String
Returns the text of the paragraph, but not of any objects in the
paragraph
Returns any text from any suitable pictures in the paragraph
Returns the footnote text of the paragraph
@return the footnote text or empty string if the paragraph does not have footnotes
Returns the paragraph alignment which shall be applied to text in this
paragraph.
If this element is not Set on a given paragraph, its value is determined
by the Setting previously Set at any level of the style hierarchy (i.e.
that previous Setting remains unChanged). If this Setting is never
specified in the style hierarchy, then no alignment is applied to the
paragraph.
@return the paragraph alignment of this paragraph.
Returns the text vertical alignment which shall be applied to text in
this paragraph.
If the line height (before any Added spacing) is larger than one or more
characters on the line, all characters will be aligned to each other as
specified by this element.
If this element is omitted on a given paragraph, its value is determined
by the Setting previously Set at any level of the style hierarchy (i.e.
that previous Setting remains unChanged). If this Setting is never
specified in the style hierarchy, then the vertical alignment of all
characters on the line shall be automatically determined by the consumer.
@return the vertical alignment of this paragraph.
the top border for the paragraph
Specifies the border which shall be displayed below a Set of
paragraphs which have the same Set of paragraph border Settings.
the bottom border for the paragraph
Specifies the border which shall be displayed on the left side of the
page around the specified paragraph.
the left border for the paragraph
Specifies the border which shall be displayed on the right side of the
page around the specified paragraph.
@return ParagraphBorder - the right border for the paragraph
@see #setBorderRight(Borders)
@see Borders for a list of all possible borders
Specifies the border which shall be displayed between each paragraph in a
Set of paragraphs which have the same Set of paragraph border Settings.
@return ParagraphBorder - the between border for the paragraph
@see #setBorderBetween(Borders)
@see Borders for a list of all possible borders
Specifies that when rendering this document in a paginated
view, the contents of this paragraph are rendered on the start of a new
page in the document.
If this element is omitted on a given paragraph,
its value is determined by the Setting previously Set at any level of the
style hierarchy (i.e. that previous Setting remains unChanged). If this
Setting is never specified in the style hierarchy, then this property
shall not be applied. Since the paragraph is specified to start on a new
page, it begins page two even though it could have fit on page one.
@return bool - if page break is Set
Specifies the spacing that should be Added After the last line in this
paragraph in the document in absolute units.
@return int - value representing the spacing After the paragraph
Specifies the spacing that should be Added After the last line in this
paragraph in the document in absolute units.
@return bigint - value representing the spacing After the paragraph
@see #setSpacingAfterLines(int)
Specifies the spacing that should be Added above the first line in this
paragraph in the document in absolute units.
@return the spacing that should be Added above the first line
@see #setSpacingBefore(int)
Specifies the spacing that should be Added before the first line in this paragraph in the
document in line units.
The value of this attribute is specified in one hundredths of a line.
@return the spacing that should be Added before the first line in this paragraph
@see #setSpacingBeforeLines(int)
Specifies how the spacing between lines is calculated as stored in the
line attribute. If this attribute is omitted, then it shall be assumed to
be of a value auto if a line attribute value is present.
@return rule
@see LineSpacingRule
@see #setSpacingLineRule(LineSpacingRule)
Specifies the indentation which shall be placed between the left text
margin for this paragraph and the left edge of that paragraph's content
in a left to right paragraph, and the right text margin and the right
edge of that paragraph's text in a right to left paragraph
If this attribute is omitted, its value shall be assumed to be zero.
Negative values are defined such that the text is Moved past the text margin,
positive values Move the text inside the text margin.
@return indentation or null if indentation is not Set
Specifies the indentation which shall be placed between the right text
margin for this paragraph and the right edge of that paragraph's content
in a left to right paragraph, and the right text margin and the right
edge of that paragraph's text in a right to left paragraph
If this attribute is omitted, its value shall be assumed to be zero.
Negative values are defined such that the text is Moved past the text margin,
positive values Move the text inside the text margin.
@return indentation or null if indentation is not Set
Specifies the indentation which shall be Removed from the first line of
the parent paragraph, by moving the indentation on the first line back
towards the beginning of the direction of text flow.
This indentation is
specified relative to the paragraph indentation which is specified for
all other lines in the parent paragraph.
The firstLine and hanging
attributes are mutually exclusive, if both are specified, then the
firstLine value is ignored.
@return indentation or null if indentation is not Set
Specifies the Additional indentation which shall be applied to the first
line of the parent paragraph. This Additional indentation is specified
relative to the paragraph indentation which is specified for all other
lines in the parent paragraph.
The firstLine and hanging attributes are
mutually exclusive, if both are specified, then the firstLine value is
ignored.
If the firstLineChars attribute is also specified, then this
value is ignored.
If this attribute is omitted, then its value shall be
assumed to be zero (if needed).
@return indentation or null if indentation is not Set
This element specifies whether a consumer shall break Latin text which
exceeds the text extents of a line by breaking the word across two lines
(breaking on the character level) or by moving the word to the following
line (breaking on the word level).
@return bool
@return the style of the paragraph
returns the type of the BodyElement Paragraph
@see NPOI.XWPF.UserModel.IBodyElement#getElementType()
returns the partType of the bodyPart which owns the bodyElement
@see NPOI.XWPF.UserModel.IBody#getPartType()
@author Philipp Epp
Link Picture with PictureData
@param rel
Return the underlying CTPicture bean that holds all properties for this picture
@return the underlying CTPicture bean
Get the PictureData of the Picture, if present.
Note - not all kinds of picture have data
Raw picture data, normally attached to a WordProcessingML Drawing. As a rule, pictures are stored in the /word/media/ part of a WordProcessingML package.
@author Philipp Epp
Relationships for each known picture type
Create a new XWPFGraphicData node
Construct XWPFPictureData from a package part
@param part the package part holding the Drawing data,
@param rel the package relationship holding this Drawing,
the relationship type must be http://schemas.Openxmlformats.org/officeDocument/2006/relationships/image
Gets the picture data as a byte array.
Note, that this call might be expensive since all the picture data is copied into a temporary byte array.
You can grab the picture data directly from the underlying package part as follows:
InputStream is1 = GetPackagePart().InputStream;
@return the Picture data.
Returns the file name of the image, eg image7.jpg . The original filename
isn't always available, but if it can be found it's likely to be in the
CTDrawing
Suggests a file extension for this image.
@return the file extension.
Return an integer constant that specifies type of this picture
@return an integer constant that specifies type of this picture
@see NPOI.XWPF.UserModel.PictureTypeEMF
@see NPOI.XWPF.UserModel.PictureTypeWMF
@see NPOI.XWPF.UserModel.PictureTypePICT
@see NPOI.XWPF.UserModel.PictureTypeJPEG
@see NPOI.XWPF.UserModel.PictureTypePNG
@see NPOI.XWPF.UserModel.PictureTypeDIB
@author Yegor Kozlov
A map to lookup POIXMLRelation by its relation type
Supported image formats
Get POIXMLRelation by relation type
@param rel relation type, for example,
http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
@return registered POIXMLRelation or null if not found
In the zoom tag inside Settings.xml file
it Sets the value of zoom
@return percentage as an integer of zoom level
Set zoom. In the zoom tag inside settings.xml file it sets the value of zoom
sample snippet from Settings.xml
<w:zoom w:percent="50" />
Verifies the documentProtection tag inside Settings.xml file
if the protection is enforced (w:enforcement="1")
and if the kind of protection Equals to passed (STDocProtect.Enum editValue)
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="readOnly" w:enforcement="1"/>
@return true if documentProtection is enforced with option ReadOnly
Enforces the protection with the option specified by passed editValue.
In the documentProtection tag inside Settings.xml file
it Sets the value of enforcement to "1" (w:enforcement="1")
and the value of edit to the passed editValue (w:edit="[passed editValue]")
sample snippet from Settings.xml
<w:settings ... >
<w:documentProtection w:edit="[passed editValue]" w:enforcement="1"/>
Removes protection enforcement.
In the documentProtection tag inside Settings.xml file
it Sets the value of enforcement to "0" (w:enforcement="0")
Enforces fields update on document open (in Word).
In the settings.xml file
sets the updateSettings value to true (w:updateSettings w:val="true")
NOTICES:
- Causing Word to ask on open: "This document contains fields that may refer to other files. Do you want to update the fields in this document?"
(if "Update automatic links at open" is enabled)
- Flag is removed after saving with changes in Word
@author Philipp Epp
constructor
@param style
constructor
@param style
@param styles
Set style
@param style
Get ctStyle
@return ctStyle
Get styles
@return styles the styles to which this style belongs
Compares the names of the Styles
@param compStyle
Get StyleID of the style
@return styleID StyleID of the style
Get Type of the Style
@return ctType
Get StyleID of the linked Style
Get StyleID of the next style
@author Philipp Epp
Construct XWPFStyles from a package part
@param part the package part holding the data of the styles,
@param rel the package relationship of type "http://schemas.Openxmlformats.org/officeDocument/2006/relationships/styles"
Construct XWPFStyles from scratch for a new document.
Read document
Sets the ctStyles
@param styles
Checks whether style with styleID exist
@param styleID styleID of the Style in the style-Document
@return true if style exist, false if style not exist
add a style to the document
@param style
@throws IOException
get style by a styleID
@param styleID styleID of the searched style
@return style
Get the styles which are related to the parameter style and their relatives
this method can be used to copy all styles from one document to another document
@param style
@return a list of all styles which were used by this method
Get the styles which are related to parameter style
@param style
@return all Styles of the parameterList
Sets the default spelling language on ctStyles DocDefaults parameter
@param strSpellingLanguage
Sets the default East Asia spelling language on ctStyles DocDefaults parameter
@param strEastAsia
Sets the default font on ctStyles DocDefaults parameter
@param fonts
Get latentstyles
Get the style with the same name
if this style is not existing, return null
Sketch of XWPFTable class. Only table's text is being hold.
Specifies the contents of a table present in the document. A table is a Set
of paragraphs (and other block-level content) arranged in rows and columns.
@author Yury Batrakov (batrakov at gmail.com)
@author Gregg Morris (gregg dot morris at gmail dot com) - added
setStyleID()
getRowBandSize(), setRowBandSize()
getColBandSize(), setColBandSize()
getInsideHBorderType(), getInsideHBorderSize(), getInsideHBorderSpace(), getInsideHBorderColor()
getInsideVBorderType(), getInsideVBorderSize(), getInsideVBorderSpace(), getInsideVBorderColor()
setInsideHBorder(), setInsideVBorder()
getCellMarginTop(), getCellMarginLeft(), getCellMarginBottom(), getCellMarginRight()
setCellMargins()
@return ctTbl object
add a new column for each row in this table
create a new XWPFTableRow object with as many cells as the number of columns defined in that moment
@return tableRow
@param pos - index of the row
@return the row at the position specified or null if no rows is defined or if the position is greather than the max size of rows array
add a new Row to the table
@param row the row which should be Added
add a new Row to the table
at position pos
@param row the row which should be Added
inserts a new tablerow
@param pos
@return the inserted row
Remove a row at position pos from the table
@param pos position the Row in the Table
returns the part of the bodyElement
@see NPOI.XWPF.UserModel.IBody#getPart()
returns the XWPFRow which belongs to the CTRow row
if this row is not existing in the table null will be returned
@return text
@return width value
@return number of rows in table
Get the StyleID of the table
@return style-ID of the table
returns the type of the BodyElement Table
@see NPOI.XWPF.UserModel.IBodyElement#getElementType()
returns the partType of the bodyPart which owns the bodyElement
@see NPOI.XWPF.UserModel.IBody#getPartType()
XWPFTableCell class.
@author Gregg Morris (gregg dot morris at gmail dot com) - added XWPFVertAlign enum,
setColor(),
setVerticalAlignment()
If a table cell does not include at least one block-level element, then this document shall be considered corrupt
Add a Paragraph to this Table Cell
@return The paragraph which was Added
add a Paragraph to this TableCell
@param p the paragaph which has to be Added
Removes a paragraph of this tablecell
@param pos
if there is a corresponding {@link XWPFParagraph} of the parameter ctTable in the paragraphList of this table
the method will return this paragraph
if there is no corresponding {@link XWPFParagraph} the method will return null
@param p is instance of CTP and is searching for an XWPFParagraph
@return null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this table
XWPFParagraph with the correspondig CTP p
Set cell color. This sets some associated values; for finer control
you may want to access these elements individually.
@param rgbStr - the desired cell color, in the hex form "RRGGBB".
Get cell color. Note that this method only returns the "fill" value.
@return RGB string of cell color
Set the vertical alignment of the cell.
@param vAlign - the desired alignment enum value
Get the vertical alignment of the cell.
@return the cell alignment enum value
add a new paragraph at position of the cursor
@param cursor
@return the inserted paragraph
verifies that cursor is on the right position
@see NPOI.XWPF.UserModel.IBody#getParagraphArray(int)
Get the to which the TableCell belongs
@see NPOI.XWPF.UserModel.IBody#getPart()
Get a table by its CTTbl-Object
@see NPOI.XWPF.UserModel.IBody#getTable(org.Openxmlformats.schemas.wordProcessingml.x2006.main.CTTbl)
@see NPOI.XWPF.UserModel.IBody#getTableArray(int)
inserts an existing XWPFTable to the arrays bodyElements and tables
@see NPOI.XWPF.UserModel.IBody#insertTable(int, NPOI.XWPF.UserModel.XWPFTable)
Get the TableCell which belongs to the TableCell
returns an Iterator with paragraphs and tables
@see NPOI.XWPF.UserModel.IBody#getBodyElements()
returns a list of paragraphs
@see NPOI.XWPF.UserModel.IBody#getPartType()
@see NPOI.XWPF.UserModel.IBody#getTables()
@author gisellabronzetti
@author gregg morris - added removeCell(), setCantSplitRow(), setRepeatHeader()
create a new XWPFTableCell and add it to the tableCell-list of this tableRow
@return the newly Created XWPFTableCell
Adds a new TableCell at the end of this tableRow
This element specifies the height of the current table row within the
current table. This height shall be used to determine the resulting
height of the table row, which may be absolute or relative (depending on
its attribute values). If omitted, then the table row shall automatically
resize its height to the height required by its contents (the equivalent
of an hRule value of auto).
@param height
This element specifies the height of the current table row within the
current table. This height shall be used to determine the resulting
height of the table row, which may be absolute or relative (depending on
its attribute values). If omitted, then the table row shall automatically
resize its height to the height required by its contents (the equivalent
of an hRule value of auto).
@return height
create and return a list of all XWPFTableCell
who belongs to this row
@return a list of {@link XWPFTableCell}
returns the XWPFTableCell which belongs to the CTTC cell
if there is no XWPFTableCell which belongs to the parameter CTTc cell null will be returned
This attribute controls whether to allow table rows to split across pages.
The logic for this attribute is a little unusual: a true value means
DON'T allow rows to split, false means allow rows to split.
@param split - if true, don't allow rows to be split. If false, allow
rows to be split.
Return true if the "can't split row" value is true. The logic for this
attribute is a little unusual: a TRUE value means DON'T allow rows to
split, FALSE means allow rows to split.
@return true if rows can't be split, false otherwise.
This attribute controls whether to repeat a table's header row at the top
of a table split across pages.
@param repeat - if TRUE, repeat header row at the top of each page of table;
if FALSE, don't repeat header row.
Return true if a table's header row should be repeated at the top of a
table split across pages.
@return true if table's header row should be repeated at the top of each
page of table, false otherwise.