Package org.odftoolkit.odfdom.doc.table
Class OdfTableColumn
- java.lang.Object
-
- org.odftoolkit.odfdom.doc.table.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OdfTableCellgetCellByIndex(int index)Get a cell with a specific index.intgetCellCount()Get the count of cells in this column.intgetColumnIndex()Get the index of this column in the owner table.OdfStylegetDefaultCellStyle()Get the default cell style of this column.static OdfTableColumngetInstance(TableTableColumnElement colElement)Get theOdfTableColumninstance from theTableTableColumnElementinstance.OdfTableColumngetNextColumn()Get the next column of the current column.TableTableColumnElementgetOdfElement()Return an instance ofTableTableColumnElementwhich represents this feature.OdfTableColumngetPreviousColumn()Get the previous column of the current column.OdfTablegetTable()Get owner table of the current column.longgetWidth()Get the width of the column (in Millimeter).booleanisOptimalWidth()Returns if the column always keeps its optimal width.voidsetDefaultCellStyle(OdfStyle style)Set the default cell style to this column.voidsetUseOptimalWidth(boolean isUseOptimalWidth)Set if the column always keeps its optimal width.voidsetWidth(long width)Set the width of the column (in Millimeter).
-
-
-
Method Detail
-
getInstance
public static OdfTableColumn getInstance(TableTableColumnElement colElement)
Get theOdfTableColumninstance from theTableTableColumnElementinstance.Each
TableTableColumnElementinstance has a one-to-one relationship to the aOdfTableColumninstance.- Parameters:
colElement- the column element that need to get the correspondingOdfTableColumninstance- Returns:
- the
OdfTableColumninstance 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 ofTableTableColumnElementwhich 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
-
-