public class XSSFTable extends POIXMLDocumentPart implements Table
POIXMLDocumentPart.RelationPartisStructuredReference| Constructor and Description |
|---|
XSSFTable() |
XSSFTable(PackagePart part) |
XSSFTable(PackagePart part,
PackageRelationship rel)
Deprecated.
in POI 3.14, scheduled for removal in POI 3.16
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
commit()
Save the content in the underlying package part.
|
int |
findColumnIndex(java.lang.String columnHeader)
Gets the relative column index of a column in this table having the header name
column. |
java.lang.String |
getCommonXpath()
Calculates the xpath of the root element for the table.
|
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable |
getCTTable()
get the underlying CTTable XML bean
|
java.lang.String |
getDisplayName() |
CellReference |
getEndCellReference() |
int |
getEndColIndex()
Get the bottom-right column index on the sheet
|
int |
getEndRowIndex()
Get the bottom-right row index
|
java.lang.String |
getName()
Get the name of the table.
|
long |
getNumberOfMappedColumns() |
long |
getNumerOfMappedColumns()
Deprecated.
3.15 beta 2. Use
getNumberOfMappedColumns(). |
int |
getRowCount() |
java.lang.String |
getSheetName()
Returns the sheet name that the table belongs to.
|
CellReference |
getStartCellReference() |
int |
getStartColIndex()
Get the top-left column index relative to the sheet
|
int |
getStartRowIndex()
Get the top-left row index on the sheet
|
java.util.List<XSSFXmlColumnPr> |
getXmlColumnPrs()
Note this list is static - once read, it does not notice later changes to the underlying column structures
To clear the cache, call
updateHeaders() |
XSSFSheet |
getXSSFSheet() |
boolean |
isHasTotalsRow()
Returns true iff the table has a 'Totals' row
|
boolean |
mapsTo(long id)
Checks if this Table element contains even a single mapping to the map identified by id
|
void |
readFrom(java.io.InputStream is) |
void |
setDisplayName(java.lang.String name)
Changes the display name of the Table
|
void |
setName(java.lang.String name)
Changes the name of the Table
|
void |
updateHeaders()
Synchronize table headers with cell values in the parent sheet.
|
void |
updateReferences()
Clears the cached values set by
getStartCellReference()
and getEndCellReference(). |
void |
writeTo(java.io.OutputStream out) |
_invokeOnDocumentRead, addRelation, addRelation, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, toStringpublic XSSFTable()
public XSSFTable(PackagePart part) throws java.io.IOException
java.io.IOException@Deprecated public XSSFTable(PackagePart part, PackageRelationship rel) throws java.io.IOException
java.io.IOExceptionpublic void readFrom(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic XSSFSheet getXSSFSheet()
public void writeTo(java.io.OutputStream out)
throws java.io.IOException
java.io.IOExceptionprotected void commit()
throws java.io.IOException
POIXMLDocumentPart
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
out.close();
}
commit in class POIXMLDocumentPartjava.io.IOException - a subclass may throw an IOException if the changes can't be committed@Internal(since="POI 3.15 beta 3") public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable getCTTable()
public boolean mapsTo(long id)
id - the XSSFMap IDpublic java.lang.String getCommonXpath()
updateHeaders() must be called.public java.util.List<XSSFXmlColumnPr> getXmlColumnPrs()
updateHeaders()public java.lang.String getName()
Tablepublic void setName(java.lang.String name)
public java.lang.String getDisplayName()
public void setDisplayName(java.lang.String name)
public long getNumberOfMappedColumns()
public long getNumerOfMappedColumns()
getNumberOfMappedColumns().public CellReference getStartCellReference()
updateReferences().public CellReference getEndCellReference()
updateReferences().public void updateReferences()
getStartCellReference()
and getEndCellReference().
The next call to getStartCellReference() and
getEndCellReference() will synchronize the
cell references with the underlying CTTable.
Thus, updateReferences() is inexpensive.public int getRowCount()
0 if the start or end cell references are not set.
Does not track updates to underlying changes to CTTable
To synchronize with changes to the underlying CTTable,
call updateReferences().public void updateHeaders()
updateReferences() and
updateHeaders(), updateReferences()
should be called first.public int findColumnIndex(java.lang.String columnHeader)
column.
The column index is relative to the left-most column in the table, 0-indexed.
Returns -1 if column is not a header name in table.
Column Header names are case-insensitive
Note: this function caches column names for performance. To flush the cache (because columns
have been moved or column headers have been changed), updateHeaders() must be called.findColumnIndex in interface TablecolumnHeader - the column header name to get the table column index ofcolumnHeaderpublic java.lang.String getSheetName()
TablegetSheetName in interface Tablepublic boolean isHasTotalsRow()
TableisHasTotalsRow in interface Tablepublic int getStartColIndex()
TablegetStartColIndex in interface Tablepublic int getStartRowIndex()
TablegetStartRowIndex in interface Tablepublic int getEndColIndex()
TablegetEndColIndex in interface Tablepublic int getEndRowIndex()
TablegetEndRowIndex in interface TableCopyright 2018 The Apache Software Foundation or its licensors, as applicable.