|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odftoolkit.odfdom.doc.table.OdfTable
org.odftoolkit.simple.table.Table
in Simple API.
public class OdfTable
OdfTable represents the table feature in ODF spreadsheet and text documents.
OdfTable provides methods to get/add/delete/modify table column/row/cell.
Field Summary | |
---|---|
protected OdfDocument |
mDocument
Deprecated. |
protected boolean |
mIsCellStyleInheritance
Deprecated. |
protected boolean |
mIsSpreadsheet
Deprecated. |
Method Summary | |
---|---|
OdfTableColumn |
appendColumn()
Deprecated. Append a column at the end of the table. |
List<OdfTableColumn> |
appendColumns(int columnCount)
Deprecated. Append a specific number of columns to the right of the table. |
OdfTableRow |
appendRow()
Deprecated. Append a row to the end of the table. |
List<OdfTableRow> |
appendRows(int rowCount)
Deprecated. Append a specific number of rows to the end of the table. |
OdfTableCell |
getCellByPosition(int colIndex,
int rowIndex)
Deprecated. Return a single cell that is positioned at the specified column and row. |
OdfTableCell |
getCellByPosition(String address)
Deprecated. Return a single cell that is positioned at the specified cell address. |
OdfTableCellRange |
getCellRangeByName(String name)
Deprecated. Return a range of cells by a specified name. |
OdfTableCellRange |
getCellRangeByPosition(int startCol,
int startRow,
int endCol,
int endRow)
Deprecated. Return a range of cells within the specified range. |
OdfTableCellRange |
getCellRangeByPosition(String startAddress,
String endAddress)
Deprecated. Return a range of cells within the specified range. |
OdfTableColumn |
getColumnByIndex(int index)
Deprecated. Get the column at the specified index. |
int |
getColumnCount()
Deprecated. Get the column count of this table. |
List<OdfTableColumn> |
getColumnList()
Deprecated. Return a list of columns in the current table. |
int |
getHeaderColumnCount()
Deprecated. Return the number of header columns in the table. |
int |
getHeaderRowCount()
Deprecated. Return the number of header rows in this table. |
static OdfTable |
getInstance(TableTableElement odfElement)
Deprecated. Get a table feature instance by an instance of TableTableElement . |
TableTableElement |
getOdfElement()
Deprecated. Return an instance of TableTableElement which represents this feature. |
OdfTableRow |
getRowByIndex(int index)
Deprecated. Get the row at the specified index. |
int |
getRowCount()
Deprecated. Get the row count of this table. |
List<OdfTableRow> |
getRowList()
Deprecated. Return a list of table rows in the current table. |
String |
getTableName()
Deprecated. Return the table name. |
long |
getWidth()
Deprecated. Get the width of the table (in Millimeter). |
List<OdfTableColumn> |
insertColumnsBefore(int index,
int columnCount)
Deprecated. Insert a specific number of columns before the column whose index is index . |
List<OdfTableRow> |
insertRowsBefore(int index,
int rowCount)
Deprecated. Insert a specific number of rows before the row at index . |
protected boolean |
isCellStyleInheritance()
Deprecated. Return true if cell style is inherited when a new cell is added to the table. |
boolean |
isProtected()
Deprecated. Return true if the table is protected. |
static OdfTable |
newTable(OdfDocument document)
Deprecated. Construct the OdfTable feature. |
static OdfTable |
newTable(OdfDocument document,
int numRows,
int numCols)
Deprecated. Construct the OdfTable feature
with a specified row number and column number. |
static OdfTable |
newTable(OdfDocument document,
int numRows,
int numCols,
int headerRowNumber,
int headerColumnNumber)
Deprecated. Construct the OdfTable feature with a specified 2 dimension array as the data of this table. |
static OdfTable |
newTable(OdfDocument document,
String[] rowLabel,
String[] columnLabel,
double[][] data)
Deprecated. Construct the OdfTable feature with a specified 2 dimension array as the data of this table. |
static OdfTable |
newTable(OdfDocument document,
String[] rowLabel,
String[] columnLabel,
String[][] data)
Deprecated. Construct the OdfTable feature with a specified 2 dimension array as the data of this table. |
static OdfTable |
newTable(OdfElement tableParent)
Deprecated. Construct the OdfTable feature. |
static OdfTable |
newTable(OdfElement tableParent,
int numRows,
int numCols)
Deprecated. Construct the OdfTable feature
with a specified row number and column number. |
static OdfTable |
newTable(OdfElement tableParent,
int numRows,
int numCols,
int headerRowNumber,
int headerColumnNumber)
Deprecated. Construct the OdfTable feature
with a specified row number, column number, header row number, header column number. |
static OdfTable |
newTable(OdfElement tableParent,
String[] rowLabel,
String[] columnLabel,
double[][] data)
Deprecated. Construct the OdfTable feature with a specified 2 dimension array as the data of this table. |
static OdfTable |
newTable(OdfElement tableParent,
String[] rowLabel,
String[] columnLabel,
String[][] data)
Deprecated. Construct the OdfTable feature with a specified 2 dimension array as the data of this table. |
void |
remove()
Deprecated. Remove this table from the document |
void |
removeColumnsByIndex(int startIndex,
int deleteColCount)
Deprecated. Remove a specific number of columns, starting from the column at index . |
void |
removeRowsByIndex(int startIndex,
int deleteRowCount)
Deprecated. Remove the specific number of rows, starting from the row at index . |
protected void |
setCellStyleInheritance(boolean isEnabled)
Deprecated. This method allows users to set whether cell style is inherited or not when a new cell is added to the table. |
void |
setProtected(boolean isProtected)
Deprecated. Set if the table is protected. |
void |
setTableName(String tableName)
Deprecated. Set the table name. |
void |
setWidth(long width)
Deprecated. Set the width of the table (in Millimeter). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected OdfDocument mDocument
protected boolean mIsSpreadsheet
protected boolean mIsCellStyleInheritance
Method Detail |
---|
public static OdfTable getInstance(TableTableElement odfElement)
TableTableElement
.
odfElement
- an instance of TableTableElement
OdfTable
that can represent odfElement
public long getWidth()
Throw an UnsupportedOperationException if the table is one sheet of a spreadsheet document. because the sheet doesn't have an attribute of table width.
An UnsupportedOperationException will be thrown if the table is in the spreadsheet document.
public void setWidth(long width)
Throw an UnsupportedOperationException if the table is part of a spreadsheet document that does not allow to change the table size, because spreadsheet is not allow user to set the table size.
width
- the width that need to set (in Millimeter).
An UnsupportedOperationException will be thrown if the table is in the spreadsheet document.
public static OdfTable newTable(OdfElement tableParent)
OdfTable
feature.
The default column count is 5.
The default row count is 2.
The table will be inserted at the end of the document the parent element belongs to.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
tableParent
- the ODF element the new table will be appended to
OdfTable
feature instancepublic static OdfTable newTable(OdfDocument document)
OdfTable
feature.
The default column count is 5.
The default row count is 2.
The table will be inserted at the end of the given document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
document
- the ODF document that contains this feature
OdfTable
feature instancepublic static OdfTable newTable(OdfElement tableParent, int numRows, int numCols)
OdfTable
feature
with a specified row number and column number.
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
tableParent
- the ODF element the new table will be appended tonumRows
- the row numbernumCols
- the column number
OdfTable
public static OdfTable newTable(OdfDocument document, int numRows, int numCols)
OdfTable
feature
with a specified row number and column number.
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
document
- the ODF document that contains this featurenumRows
- the row numbernumCols
- the column number
OdfTable
public static OdfTable newTable(OdfElement tableParent, int numRows, int numCols, int headerRowNumber, int headerColumnNumber)
OdfTable
feature
with a specified row number, column number, header row number, header column number.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
tableParent
- the ODF element the new table will be appended tonumRows
- the row numbernumCols
- the column numberheaderRowNumber
- the header row numberheaderColumnNumber
- the header column number
OdfTable
public static OdfTable newTable(OdfDocument document, int numRows, int numCols, int headerRowNumber, int headerColumnNumber)
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
document
- the ODF document that contains this featurenumRows
- the row numbernumCols
- the column numberheaderRowNumber
- the header row numberheaderColumnNumber
- the header column number
OdfTable
public static OdfTable newTable(OdfElement tableParent, String[] rowLabel, String[] columnLabel, double[][] data)
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
tableParent
- the ODF document that contains this featurerowLabel
- set as the header row, it can be null if no header row neededcolumnLabel
- set as the header column, it can be null if no header column neededdata
- the two dimension array of double as the data of this table
OdfTable
public static OdfTable newTable(OdfDocument document, String[] rowLabel, String[] columnLabel, double[][] data)
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
document
- the ODF document that contains this featurerowLabel
- set as the header row, it can be null if no header row neededcolumnLabel
- set as the header column, it can be null if no header column neededdata
- the two dimension array of double as the data of this table
OdfTable
public static OdfTable newTable(OdfElement tableParent, String[] rowLabel, String[] columnLabel, String[][] data)
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
tableParent
- the ODF element the new table will be appended torowLabel
- set as the header row, it can be null if no header row neededcolumnLabel
- set as the header column, it can be null if no header column neededdata
- the two dimension array of string as the data of this table
OdfTable
public static OdfTable newTable(OdfDocument document, String[] rowLabel, String[] columnLabel, String[][] data)
The table will be inserted at the end of the document.
An unique table name will be given, you may set a custom table name using the setTableName
method.
If the document is a text document, cell borders will be created by default.
document
- the ODF document that contains this featurerowLabel
- set as the header row, it can be null if no header row neededcolumnLabel
- set as the header column, it can be null if no header column neededdata
- the two dimension array of string as the data of this table
OdfTable
public int getRowCount()
public int getColumnCount()
public OdfTableRow appendRow()
Since ODFDOM 8.5 automatic table expansion is supported. Whenever a cell
outside the current table is addressed the table is instantly expanded.
Method getCellByPosition
can randomly access any cell, no
matter it in or out of the table original range.
appendRows(int)
,
getRowByIndex(int)
,
getCellByPosition(int, int)
,
getCellByPosition(String)
public List<OdfTableRow> appendRows(int rowCount)
Since ODFDOM 8.5 automatic table expansion is supported. Whenever a cell
outside the current table is addressed the table is instantly expanded.
Method getCellByPosition
can randomly access any cell, no
matter it in or out of the table original range.
rowCount
- is the number of rows to be appended.
appendRow()
,
getRowByIndex(int)
,
getCellByPosition(int, int)
,
getCellByPosition(String)
public OdfTableColumn appendColumn()
Since ODFDOM 8.5 automatic table expansion is supported. Whenever a cell
outside the current table is addressed the table is instantly expanded.
Method getCellByPosition
can randomly access any cell, no
matter it in or out of the table original range.
appendColumns(int)
,
getColumnByIndex(int)
,
getCellByPosition(int, int)
,
getCellByPosition(String)
public List<OdfTableColumn> appendColumns(int columnCount)
Since ODFDOM 8.5 automatic table expansion is supported. Whenever a cell
outside the current table is addressed the table is instantly expanded.
Method getCellByPosition
can randomly access any cell, no
matter it in or out of the table original range.
columnCount
- is the number of columns to be appended.
appendColumn()
,
getColumnByIndex(int)
,
getCellByPosition(int, int)
,
getCellByPosition(String)
public TableTableElement getOdfElement()
TableTableElement
which represents this feature.
TableTableElement
public List<OdfTableColumn> insertColumnsBefore(int index, int columnCount)
index
.
index
- is the index of the column to insert before.columnCount
- is the number of columns to insert.
public void removeColumnsByIndex(int startIndex, int deleteColCount)
index
.
startIndex
- is the index of the first column to delete.deleteColCount
- is the number of columns to delete.public List<OdfTableRow> insertRowsBefore(int index, int rowCount)
index
.
index
- is the index of the row to insert before.rowCount
- is the number of rows to insert.
public List<OdfTableColumn> getColumnList()
public List<OdfTableRow> getRowList()
public OdfTableColumn getColumnByIndex(int index)
index
- the zero-based index of the column.
public OdfTableRow getRowByIndex(int index)
index
- the zero-based index of the row.
public void removeRowsByIndex(int startIndex, int deleteRowCount)
index
.
startIndex
- is the zero-based index of the first row to delete.deleteRowCount
- is the number of rows to delete.public void remove()
public int getHeaderRowCount()
public int getHeaderColumnCount()
public String getTableName()
public void setTableName(String tableName)
tableName
- the table name
IllegalArgumentException
- if the tableName is duplicate with one of tables in the current documentpublic boolean isProtected()
public void setProtected(boolean isProtected)
isProtected
- the protected attribute of the table to be setprotected boolean isCellStyleInheritance()
The default setting is inherited. In this condition, the style of new column is same with the previous column before the inserted position, while the style of new row is same with the last row before the inserted position.
This feature setting will influence appendRow()
,
appendColumn()
, appendRows()
,
appendColumns()
, insertRowsBefore()
and
insertColumnsBefore()
.
For getCellByPosition()
,
getCellRangeByPosition()
, getCellRangeByName()
,
getRowByIndex()
and getColumnByIndex()
, if need
automatically expand cells, it will return empty cell(s) without any
style settings. So inheritance setting have no effect on them.
setCellStyleInheritance(boolean)
,
appendColumn()
,
appendColumns(int)
,
appendRow()
,
appendRows(int)
,
insertColumnsBefore(int, int)
,
insertRowsBefore(int, int)
,
getCellByPosition(int, int)
,
getCellByPosition(String)
,
getCellRangeByPosition(int, int, int, int)
,
getCellRangeByPosition(String, String)
,
getCellRangeByName(String)
,
getColumnByIndex(int)
,
getRowByIndex(int)
protected void setCellStyleInheritance(boolean isEnabled)
This feature setting will influence appendRow()
,
appendColumn()
, appendRows()
,
appendColumns()
, insertRowsBefore()
and
insertColumnsBefore()
.
For getCellByPosition()
,
getCellRangeByPosition()
, getCellRangeByName()
,
getRowByIndex()
and getColumnByIndex()
, if need
automatically expand cells, it will return empty cell(s) without any
style settings. So inheritance setting have no effect on them.
isEnabled
- ifisEnabled
is true, cell style will be inherited
by new cell.isCellStyleInheritance()
,
appendColumn()
,
appendColumns(int)
,
appendRow()
,
appendRows(int)
,
insertColumnsBefore(int, int)
,
insertRowsBefore(int, int)
,
getCellByPosition(int, int)
,
getCellByPosition(String)
,
getCellRangeByPosition(int, int, int, int)
,
getCellRangeByPosition(String, String)
,
getCellRangeByName(String)
,
getColumnByIndex(int)
,
getRowByIndex(int)
public OdfTableCellRange getCellRangeByPosition(int startCol, int startRow, int endCol, int endRow)
startCol
- the column index of the first cell inside the range.startRow
- the row index of the first cell inside the range.endCol
- the column index of the last cell inside the range.endRow
- the row index of the last cell inside the range.
public OdfTableCellRange getCellRangeByPosition(String startAddress, String endAddress)
The cell address is constructed with a table name, a dot (.), an alphabetic value representing the column, and a numeric value representing the row. The table name can be omitted. For example: "$Sheet1.A1", "Sheet1.A1" and "A1" are all valid cell address.
startAddress
- the cell address of the first cell inside the range.endAddress
- the cell address of the last cell inside the range.
public OdfTableCellRange getCellRangeByName(String name)
After you get a cell range with
getCellRangeByPosition
,
you can assign a name to this cell range with the method setCellRangeName
in class
OdfTableCellRange
.
Then you will get a named range which can be represented by name.
This method can be used to get a named range.
name
- the name of the specified named range
public OdfTableCell getCellByPosition(int colIndex, int rowIndex)
colIndex
- the column index of the cell.rowIndex
- the row index of the cell.
public OdfTableCell getCellByPosition(String address)
The cell address is constructed with a table name, a dot (.), an alphabetic value representing the column, and a numeric value representing the row. The table name can be omitted. For example: "$Sheet1.A1", "Sheet1.A1" and "A1" are all valid cell address.
address
- the cell address of the cell.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |