Package org.odftoolkit.odfdom.doc.table
Class OdfTableRow
java.lang.Object
org.odftoolkit.odfdom.doc.table.OdfTableRow
OdfTableRow represents table row feature in ODF document.
OdfTableRow provides methods to get table cells that belong to this table row.
-
Method Summary
Modifier and TypeMethodDescriptiongetCellByIndex
(int index) Get a cell with a specific index.int
Return the count of real cells in this row.Get the default cell style of this row.long
Return the height of the row (in Millimeter).static OdfTableRow
getInstance
(TableTableRowElement rowElement) Get theOdfTableRow
instance from theTableTableRowElement
instance.Return the next row of the current row.Return an instance ofTableTableRowElement
which represents this feature.Return the previous row of the current row.int
Return the index of this row in the owner table.getTable()
Get owner table of the current row.boolean
Return if the row always keeps its optimal height.void
setDefaultCellStyle
(OdfStyle style) Set the default cell style to this row.void
setHeight
(long height, boolean isMinHeight) Set the height/minimal height of the row (in Millimeter) according to the second parameter.void
setUseOptimalHeight
(boolean isUseOptimalHeight) Set if the row always keeps its optimal height.
-
Method Details
-
getInstance
Get theOdfTableRow
instance from theTableTableRowElement
instance.Each
TableTableRowElement
instance has a one-to-one relationship to aOdfTableRow
instance.- Parameters:
rowElement
- the row element that need to get the correspondingOdfTableRow
instance- Returns:
- the
OdfTableRow
instance represent the specified row element
-
getTable
Get owner table of the current row.- Returns:
- the parent table of this row
-
getHeight
public long getHeight()Return the height of the row (in Millimeter).Return the minimal height, if the row height is not set,
- Returns:
- the height of the current row (in Millimeter).
-
setHeight
public void setHeight(long height, boolean isMinHeight) Set the height/minimal height of the row (in Millimeter) according to the second parameter.- Parameters:
height
- the height/minimal height that will be set to the row (in Millimeter).isMinHeight
- if it is true, the row can fit the height to the text, vice versa.
-
isOptimalHeight
public boolean isOptimalHeight()Return if the row always keeps its optimal height.- Returns:
- true if the row always keeps its optimal height; vice versa
-
setUseOptimalHeight
public void setUseOptimalHeight(boolean isUseOptimalHeight) Set if the row always keeps its optimal height.- Parameters:
isUseOptimalHeight
- the flag that indicate row should keep its optimal height or not
-
getOdfElement
Return an instance ofTableTableRowElement
which represents this feature.- Returns:
- an instance of
TableTableRowElement
-
getCellByIndex
Get a cell with a specific index. The table will be automatically expanded, when the given index is outside of the original table.- Parameters:
index
- the cell index in this row- Returns:
- the cell object in the given cell index
-
getCellCount
public int getCellCount()Return the count of real cells in this row. The cells covered by top cells are not counted.Please note it might not equal to the column count of the owner table, because some of them are the covered cells.
- Returns:
- the cell count
-
getPreviousRow
Return the previous row of the current row.- Returns:
- the previous row before this row in the owner table
-
getNextRow
Return the next row of the current row.- Returns:
- the next row after this row in the owner table
-
setDefaultCellStyle
Set the default cell style to this row.The style should already exist in this document.
- Parameters:
style
- the cell style of the document
-
getDefaultCellStyle
Get the default cell style of this row.- Returns:
- the default cell style of this row
-
getRowIndex
public int getRowIndex()Return the index of this row in the owner table.- Returns:
- the index of the row
-