Package org.odftoolkit.odfdom.doc.table
Class OdfTableColumn
java.lang.Object
org.odftoolkit.odfdom.doc.table.OdfTableColumn
OdfTableColumn represents table column feature in ODF document.
OdfTableColumn provides methods to get table cells that belong to this table column.
-
Method Summary
Modifier and TypeMethodDescriptiongetCellByIndex
(int index) Get a cell with a specific index.int
Get the count of cells in this column.int
Get the index of this column in the owner table.Get the default cell style of this column.static OdfTableColumn
getInstance
(TableTableColumnElement colElement) Get theOdfTableColumn
instance from theTableTableColumnElement
instance.Get the next column of the current column.Return an instance ofTableTableColumnElement
which represents this feature.Get the previous column of the current column.getTable()
Get owner table of the current column.long
getWidth()
Get the width of the column (in Millimeter).boolean
Returns if the column always keeps its optimal width.void
setDefaultCellStyle
(OdfStyle style) Set the default cell style to this column.void
setUseOptimalWidth
(boolean isUseOptimalWidth) Set if the column always keeps its optimal width.void
setWidth
(long width) Set the width of the column (in Millimeter).
-
Method Details
-
getInstance
Get theOdfTableColumn
instance from theTableTableColumnElement
instance.Each
TableTableColumnElement
instance has a one-to-one relationship to the aOdfTableColumn
instance.- Parameters:
colElement
- the column element that need to get the correspondingOdfTableColumn
instance- Returns:
- the
OdfTableColumn
instance represent the specified column element
-
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
Return an instance ofTableTableColumnElement
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
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
Get the previous column of the current column.- Returns:
- the previous column before this column in the owner table
-
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
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
Get the default cell style of this column.- Returns:
- the default cell style of this column
-