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() |
int |
getEndRowIndex() |
java.lang.String |
getName() |
long |
getNumberOfMappedColumns() |
long |
getNumerOfMappedColumns()
Deprecated.
3.15 beta 2. Use
getNumberOfMappedColumns(). |
int |
getRowCount() |
java.lang.String |
getSheetName() |
CellReference |
getStartCellReference() |
int |
getStartColIndex() |
int |
getStartRowIndex() |
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() |
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()
public 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 Tablepublic java.lang.String getSheetName()
getSheetName in interface Tablepublic boolean isHasTotalsRow()
isHasTotalsRow in interface Tablepublic int getStartColIndex()
getStartColIndex in interface Tablepublic int getStartRowIndex()
getStartRowIndex in interface Tablepublic int getEndColIndex()
getEndColIndex in interface Tablepublic int getEndRowIndex()
getEndRowIndex in interface Table