public class XWPFTable extends java.lang.Object implements IBodyElement, ISDTContents
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.
Modifier and Type | Class and Description |
---|---|
static class |
XWPFTable.XWPFBorderType |
Modifier and Type | Field and Description |
---|---|
protected IBody |
part |
protected java.util.List<XWPFTableRow> |
tableRows |
protected java.lang.StringBuffer |
text |
Constructor and Description |
---|
XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table,
IBody part) |
XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table,
IBody part,
int row,
int col) |
Modifier and Type | Method and Description |
---|---|
void |
addNewCol()
add a new column for each row in this table
|
void |
addNewRowBetween(int start,
int end) |
void |
addRow(XWPFTableRow row)
add a new Row to the table
|
boolean |
addRow(XWPFTableRow row,
int pos)
add a new Row to the table
at position pos
|
XWPFTableRow |
createRow()
create a new XWPFTableRow object with as many cells as the number of columns defined in that moment
|
IBody |
getBody() |
int |
getCellMarginBottom() |
int |
getCellMarginLeft() |
int |
getCellMarginRight() |
int |
getCellMarginTop() |
int |
getColBandSize() |
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl |
getCTTbl() |
BodyElementType |
getElementType()
returns the type of the BodyElement Table
|
java.lang.String |
getInsideHBorderColor() |
int |
getInsideHBorderSize() |
int |
getInsideHBorderSpace() |
XWPFTable.XWPFBorderType |
getInsideHBorderType() |
java.lang.String |
getInsideVBorderColor() |
int |
getInsideVBorderSize() |
int |
getInsideVBorderSpace() |
XWPFTable.XWPFBorderType |
getInsideVBorderType() |
int |
getNumberOfRows() |
POIXMLDocumentPart |
getPart()
returns the part of the bodyElement
|
BodyType |
getPartType()
returns the partType of the bodyPart which owns the bodyElement
|
XWPFTableRow |
getRow(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow row)
returns the XWPFRow which belongs to the CTRow row
if this row is not existing in the table null will be returned
|
XWPFTableRow |
getRow(int pos) |
int |
getRowBandSize() |
java.util.List<XWPFTableRow> |
getRows() |
java.lang.String |
getStyleID()
get the StyleID of the table
|
java.lang.String |
getText()
Convenience method to extract text in cells.
|
int |
getWidth() |
XWPFTableRow |
insertNewTableRow(int pos)
inserts a new tablerow
|
boolean |
removeRow(int pos)
Remove a row at position pos from the table
|
void |
setCellMargins(int top,
int left,
int bottom,
int right) |
void |
setColBandSize(int size) |
void |
setInsideHBorder(XWPFTable.XWPFBorderType type,
int size,
int space,
java.lang.String rgbColor) |
void |
setInsideVBorder(XWPFTable.XWPFBorderType type,
int size,
int space,
java.lang.String rgbColor) |
void |
setRowBandSize(int size) |
void |
setStyleID(java.lang.String styleName)
Set the table style.
|
void |
setWidth(int width) |
protected java.lang.StringBuffer text
protected java.util.List<XWPFTableRow> tableRows
protected IBody part
public XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table, IBody part, int row, int col)
public XWPFTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table, IBody part)
@Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl getCTTbl()
public java.lang.String getText()
To get all text within a table, see XWPFWordExtractor's appendTableText as an example.
public void addNewRowBetween(int start, int end)
public void addNewCol()
public XWPFTableRow createRow()
public XWPFTableRow getRow(int pos)
pos
- - index of the rowpublic int getWidth()
public void setWidth(int width)
width
- public int getNumberOfRows()
public java.lang.String getStyleID()
public void setStyleID(java.lang.String styleName)
styleName
- - the style name to apply to this tablepublic XWPFTable.XWPFBorderType getInsideHBorderType()
public int getInsideHBorderSize()
public int getInsideHBorderSpace()
public java.lang.String getInsideHBorderColor()
public XWPFTable.XWPFBorderType getInsideVBorderType()
public int getInsideVBorderSize()
public int getInsideVBorderSpace()
public java.lang.String getInsideVBorderColor()
public int getRowBandSize()
public void setRowBandSize(int size)
public int getColBandSize()
public void setColBandSize(int size)
public void setInsideHBorder(XWPFTable.XWPFBorderType type, int size, int space, java.lang.String rgbColor)
public void setInsideVBorder(XWPFTable.XWPFBorderType type, int size, int space, java.lang.String rgbColor)
public int getCellMarginTop()
public int getCellMarginLeft()
public int getCellMarginBottom()
public int getCellMarginRight()
public void setCellMargins(int top, int left, int bottom, int right)
public void addRow(XWPFTableRow row)
row
- the row which should be addedpublic boolean addRow(XWPFTableRow row, int pos)
row
- the row which should be addedpublic XWPFTableRow insertNewTableRow(int pos)
pos
- public boolean removeRow(int pos) throws java.lang.IndexOutOfBoundsException
pos
- position the Row in the Tablejava.lang.IndexOutOfBoundsException
public java.util.List<XWPFTableRow> getRows()
public BodyElementType getElementType()
getElementType
in interface IBodyElement
IBodyElement.getElementType()
public IBody getBody()
getBody
in interface IBodyElement
public POIXMLDocumentPart getPart()
getPart
in interface IBodyElement
IBody.getPart()
public BodyType getPartType()
getPartType
in interface IBodyElement
IBody.getPartType()
public XWPFTableRow getRow(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow row)
Copyright 2018 The Apache Software Foundation or its licensors, as applicable.