Class OdfTableRow

java.lang.Object
org.odftoolkit.odfdom.doc.table.OdfTableRow

public class OdfTableRow extends Object
OdfTableRow represents table row feature in ODF document.

OdfTableRow provides methods to get table cells that belong to this table row.

  • Method Details

    • getInstance

      public static OdfTableRow getInstance(TableTableRowElement rowElement)
      Get the OdfTableRow instance from the TableTableRowElement instance.

      Each TableTableRowElement instance has a one-to-one relationship to a OdfTableRow instance.

      Parameters:
      rowElement - the row element that need to get the corresponding OdfTableRow instance
      Returns:
      the OdfTableRow instance represent the specified row element
    • getTable

      public OdfTable 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

      public TableTableRowElement getOdfElement()
      Return an instance of TableTableRowElement which represents this feature.
      Returns:
      an instance of TableTableRowElement
    • getCellByIndex

      public OdfTableCell getCellByIndex(int index)
      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

      public OdfTableRow getPreviousRow()
      Return the previous row of the current row.
      Returns:
      the previous row before this row in the owner table
    • getNextRow

      public OdfTableRow getNextRow()
      Return the next row of the current row.
      Returns:
      the next row after this row in the owner table
    • setDefaultCellStyle

      public void setDefaultCellStyle(OdfStyle style)
      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

      public OdfStyle 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