Class OdfTableColumn


  • public class OdfTableColumn
    extends Object
    OdfTableColumn represents table column feature in ODF document.

    OdfTableColumn provides methods to get table cells that belong to this table column.

    • Method Detail

      • getInstance

        public static OdfTableColumn getInstance​(TableTableColumnElement colElement)
        Get the OdfTableColumn instance from the TableTableColumnElement instance.

        Each TableTableColumnElement instance has a one-to-one relationship to the a OdfTableColumn instance.

        Parameters:
        colElement - the column element that need to get the corresponding OdfTableColumn instance
        Returns:
        the OdfTableColumn instance represent the specified column element
      • getTable

        public OdfTable getTable()
        Get owner table of the current column.
        Returns:
        the parent table of this column
      • getWidth

        public long getWidth()
        Get the width of the column (in Millimeter).
        Returns:
        the width of the current column (in Millimeter).
      • setWidth

        public void setWidth​(long width)
        Set the width of the column (in Millimeter).
        Parameters:
        width - the width that will be set to the column (in Millimeter).
      • isOptimalWidth

        public boolean isOptimalWidth()
        Returns if the column always keeps its optimal width.
        Returns:
        true if the column always keeps its optimal width; vice versa
      • setUseOptimalWidth

        public void setUseOptimalWidth​(boolean isUseOptimalWidth)
        Set if the column always keeps its optimal width.
        Parameters:
        isUseOptimalWidth - the flag that indicate column should keep its optimal width or not
      • getOdfElement

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

        public int getCellCount()
        Get the count of cells in this column.
        Returns:
        the cells count in the current column
      • 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 column
        Returns:
        the cell object in the given cell index
      • getPreviousColumn

        public OdfTableColumn getPreviousColumn()
        Get the previous column of the current column.
        Returns:
        the previous column before this column in the owner table
      • getNextColumn

        public OdfTableColumn getNextColumn()
        Get the next column of the current column.
        Returns:
        the next column after this column in the owner table
      • getColumnIndex

        public int getColumnIndex()
        Get the index of this column in the owner table.
        Returns:
        the index of the column
      • setDefaultCellStyle

        public void setDefaultCellStyle​(OdfStyle style)
        Set the default cell style to this column.

        The style should already exist in this document.

        This method is not recommended for text document cases. These is a style assigned to each cell in tables under text documents. So setting the default cell style to a column may not work.

        Parameters:
        style - the cell style of the document
      • getDefaultCellStyle

        public OdfStyle getDefaultCellStyle()
        Get the default cell style of this column.
        Returns:
        the default cell style of this column