Home  Products  Purchase  Downloads  Demos  Forums  Blogs  Ticket  Wiki  API  Corporate

com.aspose.cells
Class Cells

java.lang.Object
  extended by com.aspose.cells.Cells

public class Cells
extends java.lang.Object

Encapsulates a collection of Cell objects.


Method Summary
 void clearContents(int startRow, int startColumn, int endRow, int endColumn)
          Clears contents of a range.
 void clearFormats(int startRow, int startColumn, int endRow, int endColumn)
          Clears formatting of a range.
 void clearRange(int startRow, int startColumn, int endRow, int endColumn)
          Clears contents and formatting of a range.
 void copyColumn(Cells sourceCells, int sourceColumnIndex, int destinationColumnIndex)
          Copys data and formattings of a whole row.
 void copyRow(Cells sourceCells, int sourceRowIndex, int destinationRowIndex)
          Copys data and formattings of a whole column.
 NamedRange createNamedRange(java.lang.String name, int startIndex, int number, boolean isVertical)
          Creates a NamedRange object from a range of cells.
 NamedRange createNamedRange(java.lang.String name, int startRow, int startColumn, int endRow, int endColumn)
          Creates a Range object from a range of cells.
 NamedRange createNamedRange(java.lang.String name, java.lang.String startCellName, java.lang.String endCellName)
          Creates a NamedRange object from a range of cells.
 void deleteColumns(int startIndex, int deletedColumns, boolean bShift)
          Removes columns from the worksheet.
 void deleteRangeShiftToLeft(int startRowIndex, int startColIndex, int endRowIndex, int endColIndex)
          Delete a range and shift cells left.
 void deleteRangeShiftUp(int startRowIndex, int startColIndex, int endRowIndex, int endColIndex)
          Delete a range and shift cells Up.
 void deleteRows(int startIndex, int deletedRows, boolean bShift)
          Removes rows from the worksheet.
 Cell find(java.lang.String inputString, Cell previousCell, FindOptions findOptions)
          Finds the cell with the input string with find options.
 Cell getCell(int rowIndex, int columnIndex)
          Gets the cell object with the specified row index and column index.
 Cell getCell(java.lang.String cellName)
          Gets the cell object by the cell name(like "A1").
 Column getColumn(int columnIndex)
          Gets the column at the given column index.
 Columns getColumns()
          Gets the collection of Column objects that represents the individual columns in this worksheet.
 float getColumnWidth(int columnIndex)
          Gets the width of the column at the given column index, in unit of characters using default font.
 int getMaxColumn()
          Gets maximum column index of cell which contains data or style.
 int getMaxDataColumn()
          Gets maximum column index of cell which contains data.
 int getMaxDataRow()
          Returns maximum row index of cell which contains data.
 int getMaxRow()
          Returns the last defined row index.
 java.util.ArrayList<CellArea> getMergedCells()
          Gets the collection of merged cell ranges in the worksheet.
 int getMinColumn()
          Gets minimum column index of cell which contains data or style.
 int getMinRow()
          Returns the first defined row index.
 Row getRow(int rowIndex)
          Gets the row at the specified row index.
 float getRowHeight(int row)
          Gets the height of the row in points.
 java.util.Iterator getRowIterator()
          Returns an iterator which can iterate all defined rows in this worksheet.
 java.util.Iterator getRowIterator(int startRowIndex)
          Returns an iterator which can iterate all defined rows in this worksheet from the start row index.
 Rows getRows()
          Gets the collection of Row objects that represents the individual rows in this worksheet.
 float getStandardHeight()
          Gets the default row height of the worksheet in points.
 float getStandardWidth()
          Returns the default column width of the worksheet, in unit of characters with default font.
 void groupColumns(int startIndex, int endIndex)
          Groups columns.
 void groupColumns(int startIndex, int endIndex, boolean isHidden)
          Groups columns.
 void groupRows(int startIndex, int endIndex)
          Groups rows.
 void groupRows(int startIndex, int endIndex, boolean isHidden)
          Groups rows.
 void hideColumn(int column)
          Hides a column.
 void hideRow(int row)
          Hides a row.
 void importArray(double[][] array, int firstRow, int firstColumn)
          Imports a two-dimension of double into a worksheet.
 void importArray(double[] array, int firstRow, int firstColumn, boolean isVertical)
          Imports an array of double into a worksheet.
 void importArray(int[][] array, int firstRow, int firstColumn)
          Imports a two-dimension of integer into a worksheet.
 void importArray(int[] array, int firstRow, int firstColumn, boolean isVertical)
          Imports an array of integer into a worksheet.
 void importArray(java.lang.String[][] array, int firstRow, int firstColumn)
          Imports a two-dimension of string into a worksheet.
 void importArray(java.lang.String[] array, int firstRow, int firstColumn, boolean isVertical)
          Imports an array of string into a worksheet.
 void importCollection(java.util.Collection collection, int firstRow, int firstColumn, boolean isVertical)
          Imports a collection of data into a worksheet.
 void importObjectArray(java.lang.Object[][] array, int firstRow, int firstColumn)
          Imports a two-dimension of data into a worksheet.
 void importObjectArray(java.lang.Object[] array, int firstRow, int firstColumn, boolean isVertical)
          Imports an array of data into a worksheet.
 int importResultSet(java.sql.ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown)
          Imports data in a ResultSet object to the worksheet.
 int importResultSet(java.sql.ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown, java.lang.String customDateFormatString, boolean convertStringToNumber)
          Imports data in a ResultSet object to the worksheet.
 int importResultSet(java.sql.ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown)
          Imports data in a ResultSet object to the worksheet.
 int importResultSet(java.sql.ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown, java.lang.String customDateFormatString, boolean convertStringToNumber)
          Imports data in a ResultSet object to the worksheet.
 int importResultSet(java.sql.ResultSet rs, java.lang.String startCell, boolean isFieldNameShown)
          Imports data in a ResultSet object to the worksheet.
 int importResultSet(java.sql.ResultSet rs, java.lang.String startCell, int rowNum, int columnNum, boolean isFieldNameShown)
          Imports data in a ResultSet object to the worksheet.
 void insertColumns(int columnIndex, int columnNum)
          Inserts multiple columns into the worksheet.
 void insertRangeShiftDown(int startRowIndex, int startColIndex, int endRowIndex, int endColIndex)
          Insert a range and shift cells down.
 void insertRangeShiftToRight(int startRowIndex, int startColIndex, int endRowIndex, int endColIndex)
          Insert a range and shift cells right.
 void insertRows(int rowIndex, int rowNum)
          Inserts multiple rows into the worksheet.
 boolean isColumnHidden(int columnIndex)
          Checks if the specified column is hidden.
 void merge(int startRow, int startColumn, int endRow, int endColumn)
          Merges a specified range of cells into a single cell.
 void removeCell(int rowIndex, int columnIndex)
          Removes a cell at the specified row index and column index from the worksheet.
 void removeCell(java.lang.String cellName)
          Removes a cell from the worksheet by the cell name.
 void removeRow(int rowIndex)
          Removes the row at the given position from the worksheet.
 void setColumnHidden(int columnIndex, boolean isHidden)
          Sets whether the specified column to be hidden or not.
 void setColumnWidth(int columnIndex, float columnWidth)
          Sets the width of the specified column, in unit of characters using default font.
 void setRangeStyle(int startRow, int endRow, int startColumn, int endColumn, Style style)
          Sets a style for an area of cells.
 void setRowHeight(int row, double height)
          Sets the row height, in points.
 void setStandardHeight(float defaultRowHeight)
          Sets the default row height of the worksheet, in unit of points.
 void setStandardWidth(float defaultColumnWidth)
          Sets the default column width of the worksheet, in unit of characters using default font.
 void ungroupColumns(int startIndex, int endIndex)
          Ungroups columns.
 void ungroupRows(int startIndex, int endIndex)
          Ungroups rows.
 void unhideColumn(int column, double width)
          Unhides a column.
 void unhideRow(int row, double height)
          Unhides a row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRows

public Rows getRows()
Gets the collection of Row objects that represents the individual rows in this worksheet.

Returns:
the collection of Row objects
Throws:
CellsException - if the worksheet has been removed from the workbook.

getColumns

public Columns getColumns()
Gets the collection of Column objects that represents the individual columns in this worksheet.

Returns:
the collection of Column objects
Throws:
CellsException - if the worksheet has been removed from the workbook.

getRow

public Row getRow(int rowIndex)
Gets the row at the specified row index.

Parameters:
rowIndex - row index.
Returns:
the row object.
Throws:
java.lang.IllegalArgumentException - if index is out of range.
CellsException - if the worksheet has been removed from the workbook.

getCell

public Cell getCell(int rowIndex,
                    int columnIndex)
Gets the cell object with the specified row index and column index.

Parameters:
rowIndex - row index
columnIndex - column index
Returns:
the cell object at the specified row index and column index.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range.
CellsException - if the worksheet has been removed.

getCell

public Cell getCell(java.lang.String cellName)
Gets the cell object by the cell name(like "A1").

Parameters:
cellName - cell name.
Returns:
the cell object.
Throws:
java.lang.IllegalArgumentException - if the cell name is invalid.
CellsException - if the worksheet has been removed from the workbook.

insertRows

public void insertRows(int rowIndex,
                       int rowNum)
Inserts multiple rows into the worksheet.

Parameters:
rowIndex - The row index to insert before.
rowNum - Number of rows to be inserted.
Throws:
CellsException - if the worksheet has been removed from the workbook.

insertColumns

public void insertColumns(int columnIndex,
                          int columnNum)
Inserts multiple columns into the worksheet.

Parameters:
columnIndex - The column index to insert before.
columnNum - Number of columns to be inserted.
Throws:
CellsException - if the worksheet has been removed from the workbook.

removeRow

public void removeRow(int rowIndex)
Removes the row at the given position from the worksheet. The specified row is removed and other rows remain unchanged. Use removeRows(int, int, boolean) to make more control.

Parameters:
rowIndex - row index.
Throws:
java.lang.IllegalArgumentException - if row index is out of range.
CellsException - if the worksheet has been removed from the workbook.

deleteRows

public void deleteRows(int startIndex,
                       int deletedRows,
                       boolean bShift)
Removes rows from the worksheet.

Parameters:
startIndex - the first row index to be removed.
deletedRows - Number of rows to be removed.
bShift - whether the rows after the deleted rows should be shifted up.

deleteColumns

public void deleteColumns(int startIndex,
                          int deletedColumns,
                          boolean bShift)
Removes columns from the worksheet.

Parameters:
startIndex - the first column index to be removed.
deletedColumns - Number of columns to be removed.
bShift - whether the columns after the deleted columns should be shifted left.

deleteRangeShiftToLeft

public void deleteRangeShiftToLeft(int startRowIndex,
                                   int startColIndex,
                                   int endRowIndex,
                                   int endColIndex)
Delete a range and shift cells left.

Parameters:
startRowIndex - Start row index.
startColIndex - Start column index.
endRowIndex - End row index.
endColIndex - End column index.

deleteRangeShiftUp

public void deleteRangeShiftUp(int startRowIndex,
                               int startColIndex,
                               int endRowIndex,
                               int endColIndex)
Delete a range and shift cells Up.

Parameters:
startRowIndex - Start row index.
startColIndex - Start column index.
endRowIndex - End row index.
endColIndex - End column index.

insertRangeShiftDown

public void insertRangeShiftDown(int startRowIndex,
                                 int startColIndex,
                                 int endRowIndex,
                                 int endColIndex)
Insert a range and shift cells down.

Parameters:
startRowIndex - Start row index.
startColIndex - Start column index.
endRowIndex - End row index.
endColIndex - End column index.

insertRangeShiftToRight

public void insertRangeShiftToRight(int startRowIndex,
                                    int startColIndex,
                                    int endRowIndex,
                                    int endColIndex)
Insert a range and shift cells right.

Parameters:
startRowIndex - Start row index.
startColIndex - Start column index.
endRowIndex - End row index.
endColIndex - End column index.

removeCell

public void removeCell(int rowIndex,
                       int columnIndex)
Removes a cell at the specified row index and column index from the worksheet.

Parameters:
rowIndex - row index of the cell.
columnIndex - column Index of the cell.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range.
CellsException - if the worksheet has been removed from the workbook.

getStandardWidth

public float getStandardWidth()
Returns the default column width of the worksheet, in unit of characters with default font.

Returns:
the default column width in characters.

setStandardWidth

public void setStandardWidth(float defaultColumnWidth)
Sets the default column width of the worksheet, in unit of characters using default font.

Parameters:
defaultColumnWidth - the default column width of the worksheet in characters. 0-255.
Throws:
java.lang.IllegalArgumentException - if the given column width is invalid(< 0 or > 255 ).
CellsException - if the worksheet has been removed from the workbook.

getStandardHeight

public float getStandardHeight()
Gets the default row height of the worksheet in points.

Returns:
the default row height in points.

setStandardHeight

public void setStandardHeight(float defaultRowHeight)
Sets the default row height of the worksheet, in unit of points.

Parameters:
defaultRowHeight - row height in points(0-409).
Throws:
java.lang.IllegalArgumentException - if the row height is invalid.
CellsException - if the worksheet has been removed from the workbook.

setRowHeight

public void setRowHeight(int row,
                         double height)
Sets the row height, in points.

Parameters:
row - row index.
height - the row height
Throws:
java.lang.IllegalArgumentException - if the row height is invalid.
CellsException - if the worksheet has been removed from the workbook.

getRowHeight

public float getRowHeight(int row)
Gets the height of the row in points.

Parameters:
row - row index.
Returns:
row height, in points.
Throws:
java.lang.IllegalArgumentException - if the row height is invalid.
CellsException - if the worksheet has been removed from the workbook.

removeCell

public void removeCell(java.lang.String cellName)
Removes a cell from the worksheet by the cell name.

Parameters:
cellName - cell name.
Throws:
java.lang.IllegalArgumentException - if the cell name is invalid.
CellsException - if the worksheet has been removed from the workbook.

setRangeStyle

public void setRangeStyle(int startRow,
                          int endRow,
                          int startColumn,
                          int endColumn,
                          Style style)
Sets a style for an area of cells.

Parameters:
startRow - start row index.
endRow - end row index.
startColumn - start column index.
endColumn - end column index.
style - style to set.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range, or start index is greater than end index.
CellsException - if the worksheet has been removed from the workbook.

getMergedCells

public java.util.ArrayList<CellArea> getMergedCells()
Gets the collection of merged cell ranges in the worksheet.

Returns:
CellArea collection. You can manipulate this collection to add or remove merged cells.

merge

public void merge(int startRow,
                  int startColumn,
                  int endRow,
                  int endColumn)
Merges a specified range of cells into a single cell.

Parameters:
startRow - row index of the top left cell.
startColumn - column index of the top left cell.
endRow - row index of the bottom right cell.
endColumn - column index of the bottom right cell.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range, or start index is greater than end index.

hideRow

public void hideRow(int row)
Hides a row.

Parameters:
row - Row index.
Throws:
java.lang.IllegalArgumentException - if row index is out of range.

unhideRow

public void unhideRow(int row,
                      double height)
Unhides a row.

Parameters:
row - Row index.
height - Row height.
Throws:
java.lang.IllegalArgumentException - if row index is out of range.

hideColumn

public void hideColumn(int column)
Hides a column.

Parameters:
column - Column index.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

unhideColumn

public void unhideColumn(int column,
                         double width)
Unhides a column.

Parameters:
column - Column index.
width - Column width.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

groupRows

public void groupRows(int startIndex,
                      int endIndex)
Groups rows.

Parameters:
startIndex - The first row index to be grouped.
endIndex - The last row index to be grouped.

groupRows

public void groupRows(int startIndex,
                      int endIndex,
                      boolean isHidden)
Groups rows.

Parameters:
startIndex - The first row index to be grouped.
endIndex - The last row index to be grouped.
isHidden - Specifies if the grouped columns are hidden.

ungroupRows

public void ungroupRows(int startIndex,
                        int endIndex)
Ungroups rows.

Parameters:
startIndex - The first row index to be ungrouped.
endIndex - The last row index to be ungrouped.

groupColumns

public void groupColumns(int startIndex,
                         int endIndex)
Groups columns.

Parameters:
startIndex - The first column index to be grouped.
endIndex - The last column index to be grouped.

groupColumns

public void groupColumns(int startIndex,
                         int endIndex,
                         boolean isHidden)
Groups columns.

Parameters:
startIndex - The first column index to be grouped.
endIndex - The last column index to be grouped.
isHidden - Specifies if the grouped columns are hidden.

ungroupColumns

public void ungroupColumns(int startIndex,
                           int endIndex)
Ungroups columns.

Parameters:
startIndex - The first column index to be ungrouped.
endIndex - The last column index to be ungrouped.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           int rowIndex,
                           int columnIndex,
                           int rowNum,
                           int columnNum,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
rowIndex - start row index in the worksheet.
columnIndex - start column index in the worksheet.
rowNum - number of rows to import.
columnNum - number of columns to import.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           java.lang.String startCell,
                           int rowNum,
                           int columnNum,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
startCell - name of start cell to insert the resultset, such as "A1".
rowNum - number of rows to be imported.
columnNum - number of columns to be imported.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           int rowIndex,
                           int columnIndex,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
rowIndex - start row index in the worksheet.
columnIndex - start column index in the worksheet.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           java.lang.String startCell,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
startCell - name of start cell to insert the resultset, such as "A1".
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           int rowIndex,
                           int columnIndex,
                           int rowNum,
                           int columnNum,
                           boolean isFieldNameShown,
                           java.lang.String customDateFormatString,
                           boolean convertStringToNumber)
                    throws java.sql.SQLException
Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
rowIndex - start row index in the worksheet.
columnIndex - start column index in the worksheet.
rowNum - number of rows to import.
columnNum - number of columns to import.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
customDateFormatString - Date format string for cells which contain date value.
convertStringToNumber - Indicates if this method will try to convert string to number.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           int rowIndex,
                           int columnIndex,
                           boolean isFieldNameShown,
                           java.lang.String customDateFormatString,
                           boolean convertStringToNumber)
                    throws java.sql.SQLException
Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
rowIndex - start row index in the worksheet.
columnIndex - start column index in the worksheet.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
customDateFormatString - Date format string for cells which contain date value.
convertStringToNumber - Indicates if this method will try to convert string to number.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importCollection

public void importCollection(java.util.Collection collection,
                             int firstRow,
                             int firstColumn,
                             boolean isVertical)
Imports a collection of data into a worksheet.

Parameters:
collection - Data collection.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
isVertical - Specifies to import data vertically or horizontally.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importObjectArray

public void importObjectArray(java.lang.Object[] array,
                              int firstRow,
                              int firstColumn,
                              boolean isVertical)
Imports an array of data into a worksheet.

Parameters:
array - Data array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
isVertical - Specifies to import data vertically or horizontally.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the row or column index of the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importObjectArray

public void importObjectArray(java.lang.Object[][] array,
                              int firstRow,
                              int firstColumn)
Imports a two-dimension of data into a worksheet.

Parameters:
array - Data array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importArray

public void importArray(int[] array,
                        int firstRow,
                        int firstColumn,
                        boolean isVertical)
Imports an array of integer into a worksheet.

Parameters:
array - Integer array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
isVertical - Specifies to import data vertically or horizontally.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importArray

public void importArray(int[][] array,
                        int firstRow,
                        int firstColumn)
Imports a two-dimension of integer into a worksheet.

Parameters:
array - two-dimension integer array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importArray

public void importArray(java.lang.String[] array,
                        int firstRow,
                        int firstColumn,
                        boolean isVertical)
Imports an array of string into a worksheet.

Parameters:
array - String array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
isVertical - Specifies to import data vertically or horizontally.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importArray

public void importArray(java.lang.String[][] array,
                        int firstRow,
                        int firstColumn)
Imports a two-dimension of string into a worksheet.

Parameters:
array - Two-dimension String array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importArray

public void importArray(double[] array,
                        int firstRow,
                        int firstColumn,
                        boolean isVertical)
Imports an array of double into a worksheet.

Parameters:
array - Double array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
isVertical - Specifies to import data vertically or horizontally.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

importArray

public void importArray(double[][] array,
                        int firstRow,
                        int firstColumn)
Imports a two-dimension of double into a worksheet.

Parameters:
array - Two-dimension double array.
firstRow - The row number of the first cell to import in.
firstColumn - The column number of the first cell to import in.
Throws:
java.lang.IllegalArgumentException - if firstRow or firstColumn is out of range.
java.lang.IllegalArgumentException - if the cell to import data in is out of range.
CellsException - if the worksheet has been removed from the workbook.

clearContents

public void clearContents(int startRow,
                          int startColumn,
                          int endRow,
                          int endColumn)
Clears contents of a range.

Parameters:
startRow - Start row index.
startColumn - Start column index.
endRow - End row index.
endColumn - End column index.

clearFormats

public void clearFormats(int startRow,
                         int startColumn,
                         int endRow,
                         int endColumn)
Clears formatting of a range.

Parameters:
startRow - Start row index.
startColumn - Start column index.
endRow - End row index.
endColumn - End column index.

clearRange

public void clearRange(int startRow,
                       int startColumn,
                       int endRow,
                       int endColumn)
Clears contents and formatting of a range.

Parameters:
startRow - Start row index.
startColumn - Start column index.
endRow - End row index.
endColumn - End column index.

copyColumn

public void copyColumn(Cells sourceCells,
                       int sourceColumnIndex,
                       int destinationColumnIndex)
Copys data and formattings of a whole row.

Parameters:
sourceCells - Source Cells object contains data and formattings to copy.
sourceColumnIndex - Source row index.
destinationColumnIndex - Destination row index.

copyRow

public void copyRow(Cells sourceCells,
                    int sourceRowIndex,
                    int destinationRowIndex)
Copys data and formattings of a whole column.

Parameters:
sourceCells - Source Cells object contains data and formattings to copy.
sourceRowIndex - Source column index.
destinationRowIndex - Destination column index.
Throws:
java.lang.IllegalArgumentException - if source or dest row index is out of range.

getMinRow

public int getMinRow()
Returns the first defined row index.

Returns:
row index of the first defined row. Returns -1 if no row is defined.

getMaxRow

public int getMaxRow()
Returns the last defined row index.

Returns:
row index of the last defined row. Returns -1 if no row is defined.

getMaxDataRow

public int getMaxDataRow()
Returns maximum row index of cell which contains data.

Returns:
maximum row index of cell which contains data.Returns -1 if no row is defined.

getMinColumn

public int getMinColumn()
Gets minimum column index of cell which contains data or style.

Returns:
minimum column index of cell which contains data or style.Returns -1 if no column is defined.

getMaxColumn

public int getMaxColumn()
Gets maximum column index of cell which contains data or style.

Returns:
maximum column index of cell which contains data or style.Returns -1 if no column is defined.

getMaxDataColumn

public int getMaxDataColumn()
Gets maximum column index of cell which contains data.

Returns:
maximum column index of cell which contains data.Returns -1 if no column is defined.

getRowIterator

public java.util.Iterator getRowIterator()
Returns an iterator which can iterate all defined rows in this worksheet. It accesses all rows order by row index.

Returns:
an object that implements the Iterator interface.
Throws:
CellsException - if the worksheet has been removed from the workbook.

getRowIterator

public java.util.Iterator getRowIterator(int startRowIndex)
Returns an iterator which can iterate all defined rows in this worksheet from the start row index. It accesses all rows order by row index.

Parameters:
startRowIndex - Starts from row index.
Returns:
an object that implements the Iterator interface.
Throws:
CellsException - if the worksheet has been removed from the workbook.

getColumnWidth

public float getColumnWidth(int columnIndex)
Gets the width of the column at the given column index, in unit of characters using default font.

Parameters:
columnIndex - column index.
Returns:
column width in characters.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

getColumn

public Column getColumn(int columnIndex)
Gets the column at the given column index.

Parameters:
columnIndex - column index.
Returns:
the column object.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

find

public Cell find(java.lang.String inputString,
                 Cell previousCell,
                 FindOptions findOptions)
Finds the cell with the input string with find options. Return null if no cell contain the input string.

Parameters:
inputString - The string to search for.
previousCell - Previous cell with the same string. This parameter can be set to null if seaching from the start.
findOptions - find options
Returns:
Cell object.

setColumnWidth

public void setColumnWidth(int columnIndex,
                           float columnWidth)
Sets the width of the specified column, in unit of characters using default font.

Parameters:
columnIndex - column index.
columnWidth - column width in characters(0-255).
Throws:
java.lang.IllegalArgumentException - if either column index or column width is invalid.
CellsException - if the worksheet has been removed from the workbook.

isColumnHidden

public boolean isColumnHidden(int columnIndex)
Checks if the specified column is hidden.

Parameters:
columnIndex - column index.
Returns:
true if the column is hidden.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

setColumnHidden

public void setColumnHidden(int columnIndex,
                            boolean isHidden)
Sets whether the specified column to be hidden or not.

Parameters:
columnIndex - column index.
isHidden - true for hidden.
Throws:
java.lang.IllegalArgumentException - if the column index is out of range.
CellsException - if the worksheet has been removed from the workbook.

createNamedRange

public NamedRange createNamedRange(java.lang.String name,
                                   java.lang.String startCellName,
                                   java.lang.String endCellName)
Creates a NamedRange object from a range of cells.

Parameters:
name - the name of the range.
startCellName - start cell name of this cell range.
endCellName - end cell name of this cell range.
Returns:
a NamedRange object.
Throws:
java.lang.IllegalArgumentException - if cell name is invalid.
java.lang.IllegalArgumentException - if name is invalid.

createNamedRange

public NamedRange createNamedRange(java.lang.String name,
                                   int startRow,
                                   int startColumn,
                                   int endRow,
                                   int endColumn)
Creates a Range object from a range of cells.

Parameters:
name - the name of the range.
startRow - row index of the top left cell.
startColumn - column index of the top left cell.
endRow - row index of the bottom right cell.
endColumn - column index of the bottom right cell.
Returns:
a NamedRange object.
Throws:
java.lang.IllegalArgumentException - if row or column index is out of range.
java.lang.IllegalArgumentException - if name is invalid.

createNamedRange

public NamedRange createNamedRange(java.lang.String name,
                                   int startIndex,
                                   int number,
                                   boolean isVertical)
Creates a NamedRange object from a range of cells.

Parameters:
name - the name of the range.
startIndex - start row index or start column index, zero based.
number - total number of rows or columns, one based.
isVertical - true - Range created from columns of cells. False - Range created from rows of cells.
Returns:
a NamedRange object.
Throws:
java.lang.IllegalArgumentException - if row or column index is out of range.
java.lang.IllegalArgumentException - if name is invalid.