Cells
Inheritance: java.lang.Object
All Implemented Interfaces: java.lang.Iterable
public class Cells implements Iterable
Encapsulates a collection of cell relevant objects, such as Cell, Row, …etc.
Remarks
Example
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
//Set default row height
cells.setStandardHeight(20);
//Set row height
cells.setRowHeight(2, 20.5);
//Set default colum width
cells.setStandardWidth(15);
//Set column width
cells.setColumnWidth(3, 12.57);
//Merge cells
cells.merge(5, 4, 2, 2);
//Put values to cells
cells.get(0, 0).putValue(true);
cells.get(0, 1).putValue(1);
cells.get(0, 2).putValue("abc");
//Export data
Object[][] arr = cells.exportArray(0, 0, 10, 10);
Methods
addRange(Range rangeObject)
public void addRange(Range rangeObject)
Adds a range object reference to cells
Parameters:
Parameter | Type | Description |
---|---|---|
rangeObject | Range | The range object will be contained in the cells |
applyColumnStyle(int column, Style style, StyleFlag flag)
public void applyColumnStyle(int column, Style style, StyleFlag flag)
Applies formats for a whole column.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | The column index. |
style | Style | The style object which will be applied. |
flag | StyleFlag | Flags which indicates applied formatting properties. |
applyRowStyle(int row, Style style, StyleFlag flag)
public void applyRowStyle(int row, Style style, StyleFlag flag)
Applies formats for a whole row.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | The row index. |
style | Style | The style object which will be applied. |
flag | StyleFlag | Flags which indicates applied formatting properties. |
applyStyle(Style style, StyleFlag flag)
public void applyStyle(Style style, StyleFlag flag)
Applies formats for a whole worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
style | Style | The style object which will be applied. |
flag | StyleFlag | Flags which indicates applied formatting properties. |
checkCell(int row, int column)
public Cell checkCell(int row, int column)
Gets the Cell element or null at the specified cell row index and column index.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index |
column | int | Column index |
Returns: Cell - Return Cell object if a Cell object exists. Return null if the cell does not exist.
checkColumn(int columnIndex)
public Column checkColumn(int columnIndex)
Gets the Column element or null at the specified column index.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | The column index. |
Returns: Column - The Column object.
checkRow(int row)
public Row checkRow(int row)
Gets the Row element or null at the specified cell row index.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index |
Returns: Row - Returns Row object If the row object does exist, otherwise returns null.
clear()
public void clear()
Clears all data of the worksheet.
clearContents(CellArea range)
public void clearContents(CellArea range)
Clears contents of a range.
Parameters:
Parameter | Type | Description |
---|---|---|
range | CellArea | Range to be cleared. |
clearContents(int startRow, int startColumn, int endRow, int endColumn)
public void clearContents(int startRow, int startColumn, int endRow, int endColumn)
Clears contents of a range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | Start row index. |
startColumn | int | Start column index. |
endRow | int | End row index. |
endColumn | int | End column index. |
clearFormats(CellArea range)
public void clearFormats(CellArea range)
Clears formatting of a range.
Parameters:
Parameter | Type | Description |
---|---|---|
range | CellArea | Range to be cleared. |
clearFormats(int startRow, int startColumn, int endRow, int endColumn)
public void clearFormats(int startRow, int startColumn, int endRow, int endColumn)
Clears formatting of a range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | Start row index. |
startColumn | int | Start column index. |
endRow | int | End row index. |
endColumn | int | End column index. |
clearMergedCells()
public void clearMergedCells()
Clears all merged ranges.
clearRange(CellArea range)
public void clearRange(CellArea range)
Clears contents and formatting of a range.
Parameters:
Parameter | Type | Description |
---|---|---|
range | CellArea | Range to be cleared. |
clearRange(int startRow, int startColumn, int endRow, int endColumn)
public void clearRange(int startRow, int startColumn, int endRow, int endColumn)
Clears contents and formatting of a range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | Start row index. |
startColumn | int | Start column index. |
endRow | int | End row index. |
endColumn | int | End column index. |
convertStringToNumericValue()
public void convertStringToNumericValue()
Converts all string data in the worksheet to numeric value if possible.
copyColumn(Cells sourceCells, int sourceColumnIndex, int destinationColumnIndex)
public void copyColumn(Cells sourceCells, int sourceColumnIndex, int destinationColumnIndex)
Copies data and formats of a whole column.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells | Cells | Source Cells object contains data and formats to copy. |
sourceColumnIndex | int | Source column index. |
destinationColumnIndex | int | Destination column index. |
copyColumns(Cells sourceCells0, int sourceColumnIndex, int destinationColumnIndex, int columnNumber)
public void copyColumns(Cells sourceCells0, int sourceColumnIndex, int destinationColumnIndex, int columnNumber)
Copies data and formats of a whole column.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells0 | Cells | Source Cells object contains data and formats to copy. |
sourceColumnIndex | int | Source column index. |
destinationColumnIndex | int | Destination column index. |
columnNumber | int | The copied column number. |
copyColumns(Cells sourceCells0, int sourceColumnIndex, int destinationColumnIndex, int columnNumber, PasteOptions pasteOptions)
public void copyColumns(Cells sourceCells0, int sourceColumnIndex, int destinationColumnIndex, int columnNumber, PasteOptions pasteOptions)
Copies data and formats of a whole column.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells0 | Cells | Source Cells object contains data and formats to copy. |
sourceColumnIndex | int | Source column index. |
destinationColumnIndex | int | Destination column index. |
columnNumber | int | The copied column number. |
pasteOptions | PasteOptions | the options of pasting. |
copyColumns(Cells sourceCells, int sourceColumnIndex, int sourceTotalColumns, int destinationColumnIndex, int destinationTotalColumns)
public void copyColumns(Cells sourceCells, int sourceColumnIndex, int sourceTotalColumns, int destinationColumnIndex, int destinationTotalColumns)
Copies data and formats of the whole columns.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells | Cells | Source Cells object contains data and formats to copy. |
sourceColumnIndex | int | Source column index. |
sourceTotalColumns | int | The number of the source columns. |
destinationColumnIndex | int | Destination column index. |
destinationTotalColumns | int | The number of the destination columns. |
copyRow(Cells sourceCells, int sourceRowIndex, int destinationRowIndex)
public void copyRow(Cells sourceCells, int sourceRowIndex, int destinationRowIndex)
Copies data and formats of a whole row.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells | Cells | Source Cells object contains data and formats to copy. |
sourceRowIndex | int | Source row index. |
destinationRowIndex | int | Destination row index. |
copyRows(Cells sourceCells, int sourceRowIndex, int destinationRowIndex, int rowNumber)
public void copyRows(Cells sourceCells, int sourceRowIndex, int destinationRowIndex, int rowNumber)
Copies data and formats of some whole rows.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells | Cells | Source Cells object contains data and formats to copy. |
sourceRowIndex | int | Source row index. |
destinationRowIndex | int | Destination row index. |
rowNumber | int | The copied row number. |
copyRows(Cells sourceCells0, int sourceRowIndex, int destinationRowIndex, int rowNumber, CopyOptions copyOptions)
public void copyRows(Cells sourceCells0, int sourceRowIndex, int destinationRowIndex, int rowNumber, CopyOptions copyOptions)
Copies data and formats of some whole rows.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells0 | Cells | Source Cells object contains data and formats to copy. |
sourceRowIndex | int | Source row index. |
destinationRowIndex | int | Destination row index. |
rowNumber | int | The copied row number. |
copyOptions | CopyOptions | The copy options. |
copyRows(Cells sourceCells0, int sourceRowIndex, int destinationRowIndex, int rowNumber, CopyOptions copyOptions, PasteOptions pasteOptions)
public void copyRows(Cells sourceCells0, int sourceRowIndex, int destinationRowIndex, int rowNumber, CopyOptions copyOptions, PasteOptions pasteOptions)
Copies data and formats of some whole rows.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceCells0 | Cells | Source Cells object contains data and formats to copy. |
sourceRowIndex | int | Source row index. |
destinationRowIndex | int | Destination row index. |
rowNumber | int | The copied row number. |
copyOptions | CopyOptions | The copy options. |
pasteOptions | PasteOptions | the options of pasting. |
createRange(int firstIndex, int number, boolean isVertical)
public Range createRange(int firstIndex, int number, boolean isVertical)
Creates a Range object from rows of cells or columns of cells.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | First row index or first column index, zero based. |
number | int | Total number of rows or columns, one based. |
isVertical | boolean | True - Range created from columns of cells. False - Range created from rows of cells. |
Returns: Range - A Range object.
createRange(int firstRow, int firstColumn, int totalRows, int totalColumns)
public Range createRange(int firstRow, int firstColumn, int totalRows, int totalColumns)
Creates a Range object from a range of cells.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | First row of this range |
firstColumn | int | First column of this range |
totalRows | int | Number of rows |
totalColumns | int | Number of columns |
Returns: Range - A Range object
createRange(String address)
public Range createRange(String address)
Creates a Range object from an address of the range.
Parameters:
Parameter | Type | Description |
---|---|---|
address | java.lang.String | The address of the range. |
Returns: Range - A Range object
createRange(String upperLeftCell, String lowerRightCell)
public Range createRange(String upperLeftCell, String lowerRightCell)
Creates a Range object from a range of cells.
Parameters:
Parameter | Type | Description |
---|---|---|
upperLeftCell | java.lang.String | Upper left cell name. |
lowerRightCell | java.lang.String | Lower right cell name. |
Returns: Range - A Range object
deleteBlankColumns()
public void deleteBlankColumns()
Delete all blank columns which do not contain any data.
deleteBlankColumns(DeleteOptions options)
public void deleteBlankColumns(DeleteOptions options)
Delete all blank columns which do not contain any data.
Parameters:
Parameter | Type | Description |
---|---|---|
options | DeleteOptions | The options of deleting range. |
deleteBlankRows()
public void deleteBlankRows()
Delete all blank rows which do not contain any data or other object.
deleteBlankRows(DeleteOptions options)
public void deleteBlankRows(DeleteOptions options)
Delete all blank rows which do not contain any data or some special objects such as visible comment, pivot table.
Remarks
For blank rows that will be deleted, it is not only required that Row.isBlank() should be true, but also there should be no visible comment defined for any cell in those rows, and no pivot table whose range intersects with them.
Parameters:
Parameter | Type | Description |
---|---|---|
options | DeleteOptions | The options of deleting range. |
deleteColumn(int columnIndex)
public void deleteColumn(int columnIndex)
Deletes a column.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Index of the column to be deleted. |
deleteColumn(int columnIndex, boolean updateReference)
public void deleteColumn(int columnIndex, boolean updateReference)
Deletes a column.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Index of the column to be deleted. |
updateReference | boolean | Indicates whether update references in other worksheets. |
deleteColumns(int columnIndex, int totalColumns, boolean updateReference)
public void deleteColumns(int columnIndex, int totalColumns, boolean updateReference)
Deletes several columns.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Index of the first column to be deleted. |
totalColumns | int | Count of columns to be deleted. |
updateReference | boolean | Indicates whether update references in other worksheets. |
deleteColumns(int columnIndex, int totalColumns, DeleteOptions options)
public void deleteColumns(int columnIndex, int totalColumns, DeleteOptions options)
Deletes several columns.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Index of the first column to be deleted. |
totalColumns | int | Count of columns to be deleted. |
options | DeleteOptions | Options for the deleting operation |
deleteRange(int startRow, int startColumn, int endRow, int endColumn, int shiftType)
public void deleteRange(int startRow, int startColumn, int endRow, int endColumn, int shiftType)
Deletes a range of cells and shift cells according to the shift option.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | Start row index. |
startColumn | int | Start column index. |
endRow | int | End row index. |
endColumn | int | End column index. |
shiftType | int | ShiftType. Shift cells option. |
deleteRow(int rowIndex)
public void deleteRow(int rowIndex)
Deletes a row.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Index of the row to be deleted. |
deleteRow(int rowIndex, boolean updateReference)
public void deleteRow(int rowIndex, boolean updateReference)
Deletes a row.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Index of the row to be deleted. |
updateReference | boolean | Indicates whether update references in other worksheets. |
deleteRows(int rowIndex, int totalRows)
public boolean deleteRows(int rowIndex, int totalRows)
Deletes multiple rows.
Remarks
If the deleted range contains the top part(not whole) of the table(ListObject), the ranged could not be deleted and nothing will be done. It works in the same way with MS Excel.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | The first row index to be deleted. |
totalRows | int | Count of rows to be deleted. |
Returns: boolean
deleteRows(int rowIndex, int totalRows, boolean updateReference)
public boolean deleteRows(int rowIndex, int totalRows, boolean updateReference)
Deletes multiple rows in the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Index of the first row to be deleted. |
totalRows | int | Count of rows to be deleted. |
updateReference | boolean | Indicates whether update references in other worksheets. |
Returns: boolean -
deleteRows(int rowIndex, int totalRows, DeleteOptions options)
public boolean deleteRows(int rowIndex, int totalRows, DeleteOptions options)
Deletes multiple rows in the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Index of the first row to be deleted. |
totalRows | int | Count of rows to be deleted. |
options | DeleteOptions | Options for the deleting operation |
Returns: boolean -
dispose()
public void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
endCellInColumn(int startRow, int endRow, short startColumn, short endColumn)
public Cell endCellInColumn(int startRow, int endRow, short startColumn, short endColumn)
Gets the last cell with maximum column index in this range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | Start row index. |
endRow | int | End row index. |
startColumn | short | Start column index. |
endColumn | short | End column index. |
Returns: Cell - Cell object.
endCellInColumn(short columnIndex)
public Cell endCellInColumn(short columnIndex)
Gets the last cell in this column.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | short | Column index. |
Returns: Cell - Cell object.
endCellInRow(int rowIndex)
public Cell endCellInRow(int rowIndex)
Gets the last cell in this row.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Row index. |
Returns: Cell - Cell object.
endCellInRow(int startRow, int endRow, int startColumn, int endColumn)
public Cell endCellInRow(int startRow, int endRow, int startColumn, int endColumn)
Gets the last cell with maximum row index in this range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | Start row index. |
endRow | int | End row index. |
startColumn | int | Start column index. |
endColumn | int | End column index. |
Returns: Cell - Cell object.
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
exportArray(int firstRow, int firstColumn, int totalRows, int totalColumns)
public Object[][] exportArray(int firstRow, int firstColumn, int totalRows, int totalColumns)
Exports data in the Cells collection to a two-dimension array object.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | The row number of the first cell to export out. |
firstColumn | int | The column number of the first cell to export out. |
totalRows | int | Number of rows to be exported |
totalColumns | int | Number of columns to be exported |
Returns: java.lang.Object[][] - Exported cell value array object.
exportTypeArray(int firstRow, int firstColumn, int totalRows, int totalColumns)
public int[][] exportTypeArray(int firstRow, int firstColumn, int totalRows, int totalColumns)
Exports cell value type in the Cells collection to a two-dimension array object.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | The row number of the first cell to export out. |
firstColumn | int | The column number of the first cell to export out. |
totalRows | int | Number of rows to be exported. |
totalColumns | int | Number of columns to be exported. |
Returns: int[][] - CellValueType. Exported array object representing cell value types.
find(Object what, Cell previousCell)
public Cell find(Object what, Cell previousCell)
Finds the cell containing with the input object.
Remarks
Returns null (Nothing) if no cell is found.
Parameters:
Parameter | Type | Description |
---|---|---|
what | java.lang.Object | The object to search for. The type should be int,double,DateTime,string,bool. |
previousCell | Cell | Previous cell with the same object. This parameter can be set to null if searching from the start. |
Returns: Cell - Cell object.
find(Object what, Cell previousCell, FindOptions findOptions)
public Cell find(Object what, Cell previousCell, FindOptions findOptions)
Finds the cell containing with the input object.
Remarks
Returns null (Nothing) if no cell is found.
Parameters:
Parameter | Type | Description |
---|---|---|
what | java.lang.Object | The object to search for. The type should be int,double,DateTime,string,bool. |
previousCell | Cell | Previous cell with the same object. This parameter can be set to null if searching from the start. |
findOptions | FindOptions | Find options |
Returns: Cell - Cell object.
get(int row, int column)
public Cell get(int row, int column)
Gets the Cell element at the specified cell row index and column index.
Example
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
Cell cell = cells.get(0, 0); //Gets the cell at "A1"
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
column | int | Column index. |
Returns: Cell - The Cell object.
get(String cellName)
public Cell get(String cellName)
Gets the Cell element at the specified cell name.
Example
Workbook excel = new Workbook();
Cells cells = excel.getWorksheets().get(0).getCells();
Cell cell = cells.get("A1"); //Gets the cell at "A1"
Parameters:
Parameter | Type | Description |
---|---|---|
cellName | java.lang.String | Cell name,including its column letter and row number, for example A5. |
getCellStyle(int row, int column)
public Style getCellStyle(int row, int column)
Get the style of given cell.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | row index |
column | int | column |
Returns: Style - the style of given cell.
getCellsWithPlaceInCellPicture()
public Iterator getCellsWithPlaceInCellPicture()
Gets all cells that contain embedded picture.
Remarks
If there is no picture which is set as “Place in Cell” in this worksheet, null will be returned.
Returns: java.util.Iterator - Enumerator to enumerate all Cell objects that contain embedded picture
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getColumnOriginalWidthPoint(int column)
public double getColumnOriginalWidthPoint(int column)
Gets original column’s height in unit of point if the column is hidden
Remarks
NOTE: This method is now obsolete. Instead, please use Cells.GetColumnWidth(int ,bool , CellsUnitType ) method. This method will be removed 12 months later since April 2024. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | The row index. |
Returns: double - Width of column in normal view.
getColumnWidth(int column)
public double getColumnWidth(int column)
Gets the width(in unit of characters) of the specified column in normal view
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index |
Returns: double - Width of column. For spreadsheet, column width is measured as the number of characters of the maximum digit width of the numbers 0~9 as rendered in the normal style’s font.
getColumnWidth(int column, boolean isOriginal, int unitType)
public double getColumnWidth(int column, boolean isOriginal, int unitType)
Gets the column width.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | The column index. |
isOriginal | boolean | Indicates whether getting original width. |
unitType | int | CellsUnitType. |
Returns: double -
getColumnWidthInch(int column)
public double getColumnWidthInch(int column)
Gets the width of the specified column in normal view, in units of inches.
Remarks
NOTE: This method is now obsolete. Instead, please use Cells.GetColumnWidth(int ,bool , CellsUnitType ) method. This method will be removed 12 months later since April 2024. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index |
Returns: double - Width of column in normal view.
getColumnWidthPixel(int column)
public int getColumnWidthPixel(int column)
Gets the width of the specified column in normal view, in units of pixel.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index |
Returns: int - Width of column in normal view.
getColumnWidthPixel(int column, boolean original)
public int getColumnWidthPixel(int column, boolean original)
Gets the width of the specified column in normal view, in units of pixel.
Remarks
NOTE: This method is now obsolete. Instead, please use Cells.GetColumnWidth(int ,bool , CellsUnitType ) method. This method will be removed 12 months later since April 2024. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index |
original | boolean | Indicates whether returning original width even when the column is hidden |
Returns: int - Width of column in normal view.
getColumns()
public ColumnCollection getColumns()
Gets the collection of Column objects that represents the individual columns in this worksheet.
Returns: ColumnCollection
getCount()
public int getCount()
Gets the total count of instantiated Cell objects.
Returns: int
getCountLarge()
public long getCountLarge()
Gets the total count of instantiated Cell objects.
Returns: long
getDependents(boolean isAll, int row, int column)
public Cell[] getDependents(boolean isAll, int row, int column)
Get all cells which refer to the specific cell.
Parameters:
Parameter | Type | Description |
---|---|---|
isAll | boolean | Indicates whether check other worksheets |
row | int | The row index. |
column | int | The column index. |
Returns: com.aspose.cells.Cell[] -
getDependentsInCalculation(int row, int column, boolean recursive)
public Iterator getDependentsInCalculation(int row, int column, boolean recursive)
Gets all cells whose calculated result depends on specific cell.
Remarks
To use this method, please make sure the workbook has been set with true value for FormulaSettings.getEnableCalculationChain() and has been fully calculated with this setting. If there is no formula reference to this cell, null will be returned. For more details and example, please see Cell.getDependentsInCalculation(boolean)
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index of the specific cell |
column | int | Column index of the specific cell. |
recursive | boolean | Whether returns those dependents which do not reference to the specific cell directly but reference to other leafs of that cell. |
Returns: java.util.Iterator - Enumerator to enumerate all dependents(Cell objects)
getFirstCell()
public Cell getFirstCell()
Gets the first cell in this worksheet.
Remarks
Returns null if there is no data in the worksheet.
Returns: Cell
getGroupedColumnOutlineLevel(int columnIndex)
public int getGroupedColumnOutlineLevel(int columnIndex)
Gets the outline level (zero-based) of the column.
Remarks
If the column is not grouped, returns zero.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | The column index |
Returns: int - The outline level of the column
getGroupedRowOutlineLevel(int rowIndex)
public int getGroupedRowOutlineLevel(int rowIndex)
Gets the outline level (zero-based) of the row.
Remarks
If the row is not grouped, returns zero.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | The row index. |
Returns: int - The outline level (zero-based) of the row.
getLastCell()
public Cell getLastCell()
Gets the last cell in this worksheet.
Remarks
Returns null if there is no data in the worksheet.
Returns: Cell
getLastDataRow(int column)
public int getLastDataRow(int column)
Gets the last row index of cell which contains data in the specified column.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
Returns: int - last row index.
getMaxColumn()
public int getMaxColumn()
Maximum column index of those cells that have been instantiated in the collection(does not include the column where style is defined for the whole column but no cell has been instantiated in it).
Remarks
Return -1 if there is no cell.
Returns: int
getMaxDataColumn()
public int getMaxDataColumn()
Maximum column index of cell which contains data.
Remarks
-1 will be returned if there is no cell which contains data. This property needs to iterate and check all cells in a worksheet, so it is a time-consumed progress and should not be invoked repeatedly.
Returns: int
getMaxDataRow()
public int getMaxDataRow()
Maximum row index of cell which contains data.
Remarks
Return -1 if there is no cell which contains data.
Returns: int
getMaxDisplayRange()
public Range getMaxDisplayRange()
Gets the max range which includes data, merged cells and shapes.
Remarks
Reutrns null if the worksheet is empty since Aspose.Cells 21.5.2.
Returns: Range
getMaxGroupedColumnOutlineLevel()
public int getMaxGroupedColumnOutlineLevel()
Gets the max grouped column outline level (zero-based).
Returns: int - The max grouped column outline level (zero-based)
getMaxGroupedRowOutlineLevel()
public int getMaxGroupedRowOutlineLevel()
Gets the max grouped row outline level (zero-based).
Returns: int - The max grouped row outline level (zero-based)
getMaxRow()
public int getMaxRow()
Maximum row index of cell which contains data or style.
Remarks
Return -1 if there is no cell which contains data or style in the worksheet.
Returns: int
getMemorySetting()
public int getMemorySetting()
Gets the memory usage option for this cells.
See MemorySetting.
Returns: int
getMergedAreas()
public CellArea[] getMergedAreas()
Gets all merged cells.
Returns: com.aspose.cells.CellArea[]
getMergedCells()
public ArrayList getMergedCells()
Gets the collection of merged cells.
Remarks
NOTE: This method is now obsolete. Instead, please use Cells.GetMergedAreas() method. This method will be removed 12 months later since November 2023. Aspose apologizes for any inconvenience you may have experienced.
Returns: java.util.ArrayList
getMinColumn()
public int getMinColumn()
Minimum column index of those cells that have been instantiated in the collection(does not include the column where style is defined for the whole column but no cell has been instantiated in it).
Returns: int
getMinDataColumn()
public int getMinDataColumn()
Minimum column index of cell which contains data.
Remarks
-1 will be returned if there is no cell which contains data. This property needs to iterate and check all cells in a worksheet, so it is a time-consumed progress and should not be invoked repeatedly.
Returns: int
getMinDataRow()
public int getMinDataRow()
Minimum row index of cell which contains data.
Returns: int
getMinRow()
public int getMinRow()
Minimum row index of cell which contains data or style.
Returns: int
getMultiThreadReading()
public boolean getMultiThreadReading()
Gets whether the cells data model should support Multi-Thread reading. Default value of this property is false.
Remarks
If there are multiple threads to read Row/Cell objects in this collection concurrently, this property should be set as true, otherwise unexpected result may be produced. Supporting Multi-Thread reading may degrade the performance for accessing Row/Cell objects from this collection. Please note, some features cannot support Multi-Thread reading, such as formatting values(by Cell.getStringValue(), Cell.getDisplayStringValue(), .etc.). So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.
Returns: boolean
getOdsCellFields()
public OdsCellFieldCollection getOdsCellFields()
Gets the list of fields of ods.
Returns: OdsCellFieldCollection
getPreserveString()
public boolean getPreserveString()
Gets a value indicating whether all worksheet values are preserved as strings. Default is false.
Returns: boolean
getRanges()
public RangeCollection getRanges()
Gets the collection of Range objects created at run time.
Returns: RangeCollection
getRowEnumerator()
public Iterator getRowEnumerator()
Gets the rows enumerator.
Remarks
NOTE: This member is now obsolete. Instead, please use RowCollection.GetEnumerator() method. This method will be removed 12 months later since May 2023. Aspose apologizes for any inconvenience you may have experienced.
Returns: java.util.Iterator - The rows enumerator.
getRowHeight(int row)
public double getRowHeight(int row)
Gets the height of a specified row, in unit of points.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index |
Returns: double - Height of row
getRowHeight(int row, boolean isOriginal, int unitType)
public double getRowHeight(int row, boolean isOriginal, int unitType)
Gets row’s height.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | The row index. |
isOriginal | boolean | Whether returns the original row height or 0 for hidden row. |
unitType | int | CellsUnitType. Unit type of the returned height value |
Returns: double - Row’s height
getRowHeightInch(int row)
public double getRowHeightInch(int row)
Gets the height of a specified row in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index |
Returns: double - Height of row
getRowHeightPixel(int row)
public int getRowHeightPixel(int row)
Gets the height of a specified row in unit of pixel.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index |
Returns: int - Height of row
getRowOriginalHeightPoint(int row)
public double getRowOriginalHeightPoint(int row)
Gets original row’s height in unit of point if the row is hidden
Remarks
NOTE: This member is now obsolete. Instead, please use Cells.GetRowHeight(int,bool,CellsUnitType) method. This method will be removed 12 months later since April 2024. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | The row index. |
Returns: double -
getRows()
public RowCollection getRows()
Gets the collection of Row objects that represents the individual rows in this worksheet.
Returns: RowCollection
getStandardHeight()
public double getStandardHeight()
Gets the default row height in this worksheet, in unit of points.
Returns: double
getStandardHeightInch()
public double getStandardHeightInch()
Gets the default row height in this worksheet, in unit of inches.
Returns: double
getStandardHeightPixels()
public int getStandardHeightPixels()
Gets the default row height in this worksheet, in unit of pixels.
Returns: int
getStandardWidth()
public double getStandardWidth()
Gets the default column width in the worksheet, in unit of characters.
Returns: double
getStandardWidthInch()
public double getStandardWidthInch()
Gets the default column width in the worksheet, in unit of inches.
Returns: double
getStandardWidthPixels()
public int getStandardWidthPixels()
Gets the default column width in the worksheet, in unit of pixels.
Returns: int
getStyle()
public Style getStyle()
Gets the default style of the worksheet.
Returns: Style
getViewColumnWidthPixel(int column)
public int getViewColumnWidthPixel(int column)
Get the width in different view type.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | The column index. |
Returns: int - the column width in unit of pixels
getViewRowHeight(int row)
public double getViewRowHeight(int row)
Gets the height of a specified row.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
Returns: double - Height of row.
getViewRowHeightInch(int row)
public double getViewRowHeightInch(int row)
Gets the height of a specified row in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index |
Returns: double - Height of row
groupColumns(int firstIndex, int lastIndex)
public void groupColumns(int firstIndex, int lastIndex)
Groups columns.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first column index to be grouped. |
lastIndex | int | The last column index to be grouped. |
groupColumns(int firstIndex, int lastIndex, boolean isHidden)
public void groupColumns(int firstIndex, int lastIndex, boolean isHidden)
Groups columns.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first column index to be grouped. |
lastIndex | int | The last column index to be grouped. |
isHidden | boolean | Specifies if the grouped columns are hidden. |
groupRows(int firstIndex, int lastIndex)
public void groupRows(int firstIndex, int lastIndex)
Groups rows.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first row index to be grouped. |
lastIndex | int | The last row index to be grouped. |
groupRows(int firstIndex, int lastIndex, boolean isHidden)
public void groupRows(int firstIndex, int lastIndex, boolean isHidden)
Groups rows.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first row index to be grouped. |
lastIndex | int | The last row index to be grouped. |
isHidden | boolean | Specifies if the grouped rows are hidden. |
hashCode()
public native int hashCode()
Returns: int
hideColumn(int column)
public void hideColumn(int column)
Hides a column.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
hideColumns(int column, int totalColumns)
public void hideColumns(int column, int totalColumns)
Hide multiple columns.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
totalColumns | int | Column number. |
hideGroupDetail(boolean isVertical, int index)
public void hideGroupDetail(boolean isVertical, int index)
Collapses the grouped rows/columns.
Parameters:
Parameter | Type | Description |
---|---|---|
isVertical | boolean | True, collapse the grouped rows. |
index | int | The row/column index |
hideRow(int row)
public void hideRow(int row)
Hides a row.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
hideRows(int row, int totalRows)
public void hideRows(int row, int totalRows)
Hides multiple rows.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | The row index. |
totalRows | int | The row number. |
importArray(double[] doubleArray, int firstRow, int firstColumn, boolean isVertical)
public void importArray(double[] doubleArray, int firstRow, int firstColumn, boolean isVertical)
Imports an array of double into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
doubleArray | double[] | Double array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
importArray(double[][] doubleArray, int firstRow, int firstColumn)
public void importArray(double[][] doubleArray, int firstRow, int firstColumn)
Imports a two-dimension array of double into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
doubleArray | double[][] | Two-dimension double array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importArray(int[] intArray, int firstRow, int firstColumn, boolean isVertical)
public void importArray(int[] intArray, int firstRow, int firstColumn, boolean isVertical)
Imports an array of integer into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
intArray | int[] | Integer array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
importArray(int[][] intArray, int firstRow, int firstColumn)
public void importArray(int[][] intArray, int firstRow, int firstColumn)
Imports a two-dimension array of integer into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
intArray | int[][] | Two-dimension integer array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importArray(String[] stringArray, int firstRow, int firstColumn, boolean isVertical)
public void importArray(String[] stringArray, int firstRow, int firstColumn, boolean isVertical)
Imports an array of string into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
stringArray | java.lang.String[] | String array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
importArray(String[][] stringArray, int firstRow, int firstColumn)
public void importArray(String[][] stringArray, int firstRow, int firstColumn)
Imports a two-dimension array of string into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
stringArray | java.lang.String[][] | Two-dimension string array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importArrayList(ArrayList arrayList, int firstRow, int firstColumn, boolean isVertical)
public void importArrayList(ArrayList arrayList, int firstRow, int firstColumn, boolean isVertical)
Imports an arraylist of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
arrayList | java.util.ArrayList | Data arraylist. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
importCSV(InputStream stream, TxtLoadOptions options, int firstRow, int firstColumn)
public void importCSV(InputStream stream, TxtLoadOptions options, int firstRow, int firstColumn)
Import a CSV file to the cells.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The CSV file stream. |
options | TxtLoadOptions | The load options for reading text file |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importCSV(InputStream stream, String splitter, boolean convertNumericData, int firstRow, int firstColumn)
public void importCSV(InputStream stream, String splitter, boolean convertNumericData, int firstRow, int firstColumn)
Import a CSV file to the cells.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The CSV file stream. |
splitter | java.lang.String | The splitter |
convertNumericData | boolean | Whether the string in text file is converted to numeric data. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importCSV(String fileName, TxtLoadOptions options, int firstRow, int firstColumn)
public void importCSV(String fileName, TxtLoadOptions options, int firstRow, int firstColumn)
Import a CSV file to the cells.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | The CSV file name. |
options | TxtLoadOptions | The load options for reading text file |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importCSV(String fileName, String splitter, boolean convertNumericData, int firstRow, int firstColumn)
public void importCSV(String fileName, String splitter, boolean convertNumericData, int firstRow, int firstColumn)
Import a CSV file to the cells.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | The CSV file name. |
splitter | java.lang.String | The splitter |
convertNumericData | boolean | Whether the string in text file is converted to numeric data. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importCustomObjects(Collection list, int firstRow, int firstColumn, ImportTableOptions options)
public int importCustomObjects(Collection list, int firstRow, int firstColumn, ImportTableOptions options)
Imports custom objects.
Remarks
The custom objects should be the same type.
Parameters:
Parameter | Type | Description |
---|---|---|
list | java.util.Collection | The custom object |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
options | ImportTableOptions | The import options. |
Returns: int - Total number of rows imported.
importCustomObjects(Collection list, String[] propertyNames, boolean isPropertyNameShown, int firstRow, int firstColumn, int rowNumber, boolean insertRows, String dateFormatString, boolean convertStringToNumber)
public int importCustomObjects(Collection list, String[] propertyNames, boolean isPropertyNameShown, int firstRow, int firstColumn, int rowNumber, boolean insertRows, String dateFormatString, boolean convertStringToNumber)
Imports custom objects.
Remarks
The custom objects should be the same type.
Parameters:
Parameter | Type | Description |
---|---|---|
list | java.util.Collection | The custom object |
propertyNames | java.lang.String[] | The property names.If it is null,we will import all properties of the object. |
isPropertyNameShown | boolean | Indicates whether the property name will be imported to the first row. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
rowNumber | int | Number of rows to be imported. |
insertRows | boolean | Indicates whether extra rows are added to fit data. |
dateFormatString | java.lang.String | Date format string for cells. |
convertStringToNumber | boolean | Indicates if this method will try to convert string to number. |
Returns: int - Total number of rows imported.
importData(ICellsDataTable table, int firstRow, int firstColumn, ImportTableOptions options)
public int importData(ICellsDataTable table, int firstRow, int firstColumn, ImportTableOptions options)
Import data from custom data table.
Parameters:
Parameter | Type | Description |
---|---|---|
table | ICellsDataTable | The custom data table. |
firstRow | int | First row index. |
firstColumn | int | First column index. |
options | ImportTableOptions | The import options |
Returns: int -
importFormulaArray(String[] stringArray, int firstRow, int firstColumn, boolean isVertical)
public void importFormulaArray(String[] stringArray, int firstRow, int firstColumn, boolean isVertical)
Imports an array of formula into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
stringArray | java.lang.String[] | Formula array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
importObjectArray(Object[] objArray, int firstRow, int firstColumn, boolean isVertical)
public void importObjectArray(Object[] objArray, int firstRow, int firstColumn, boolean isVertical)
Imports an array of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
objArray | java.lang.Object[] | Data array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
importObjectArray(Object[] objArray, int firstRow, int firstColumn, boolean isVertical, int skip)
public void importObjectArray(Object[] objArray, int firstRow, int firstColumn, boolean isVertical, int skip)
Imports an array of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
objArray | java.lang.Object[] | Data array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
isVertical | boolean | Specifies to import data vertically or horizontally. |
skip | int | Skipped number of rows or columns. |
importResultSet(ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown)
public int importResultSet(ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
rowIndex | int | start row index in the worksheet. |
columnIndex | int | start column index in the worksheet. |
isFieldNameShown | boolean | Indicates whether the field name of the resultset will be imported to the first row. |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown, String customDateFormatString, boolean convertStringToNumber)
public int importResultSet(ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown, String customDateFormatString, boolean convertStringToNumber)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
rowIndex | int | start row index in the worksheet. |
columnIndex | int | start column index in the worksheet. |
isFieldNameShown | boolean | Indicates whether the field name of the resultset will be imported to the first row. |
customDateFormatString | java.lang.String | Date format string for cells which contain date value. |
convertStringToNumber | boolean | Indicates if this method will try to convert string to number. |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, int rowIndex, int columnIndex, ImportTableOptions options)
public int importResultSet(ResultSet rs, int rowIndex, int columnIndex, ImportTableOptions options)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
rowIndex | int | start row index in the worksheet. |
columnIndex | int | start column index in the worksheet. |
options | ImportTableOptions | The import options |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown)
public int importResultSet(ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
rowIndex | int | start row index in the worksheet. |
columnIndex | int | start column index in the worksheet. |
rowNum | int | number of rows to import. -1 to import all records in given resultset. |
columnNum | int | number of columns to import. -1 to import all columns in given resultset. |
isFieldNameShown | boolean | Indicates whether the field name of the resultset will be imported to the first row. |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown, String customDateFormatString, boolean convertStringToNumber)
public int importResultSet(ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown, String customDateFormatString, boolean convertStringToNumber)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
rowIndex | int | start row index in the worksheet. |
columnIndex | int | start column index in the worksheet. |
rowNum | int | number of rows to import. -1 to import all records in given resultset. |
columnNum | int | number of columns to import. -1 to import all columns in given resultset. |
isFieldNameShown | boolean | Indicates whether the field name of the resultset will be imported to the first row. |
customDateFormatString | java.lang.String | Date format string for cells which contain date value. |
convertStringToNumber | boolean | Indicates if this method will try to convert string to number. |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, String startCell, boolean isFieldNameShown)
public int importResultSet(ResultSet rs, String startCell, boolean isFieldNameShown)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
startCell | java.lang.String | name of start cell to insert the resultset, such as “A1”. |
isFieldNameShown | boolean | Indicates whether the field name of the resultset will be imported to the first row. |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, String startCell, ImportTableOptions options)
public int importResultSet(ResultSet rs, String startCell, ImportTableOptions options)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
startCell | java.lang.String | name of start cell to insert the resultset, such as “A1”. |
options | ImportTableOptions | The import options |
Returns: int - how many rows actually imported.
importResultSet(ResultSet rs, String startCell, int rowNum, int columnNum, boolean isFieldNameShown)
public int importResultSet(ResultSet rs, String startCell, int rowNum, int columnNum, boolean isFieldNameShown)
Imports data in a ResultSet object to the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rs | java.sql.ResultSet | the ResultSet object to import from. |
startCell | java.lang.String | name of start cell to insert the resultset, such as “A1”. |
rowNum | int | number of rows to import. -1 to import all records in given resultset. |
columnNum | int | number of columns to import. -1 to import all columns in given resultset. |
isFieldNameShown | boolean | Indicates whether the field name of the resultset will be imported to the first row. |
Returns: int - how many rows actually imported.
importTwoDimensionArray(Object[][] objArray, int firstRow, int firstColumn)
public void importTwoDimensionArray(Object[][] objArray, int firstRow, int firstColumn)
Imports a two-dimension array of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
objArray | java.lang.Object[][] | Two-dimension data array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
importTwoDimensionArray(Object[][] objArray, int firstRow, int firstColumn, boolean convertStringToNumber)
public void importTwoDimensionArray(Object[][] objArray, int firstRow, int firstColumn, boolean convertStringToNumber)
Imports a two-dimension array of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
objArray | java.lang.Object[][] | Two-dimension data array. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
convertStringToNumber | boolean | Indicates if this method will try to convert string to number. |
importTwoDimensionArray(Object[][] objArray, Object[][] styles, int firstRow, int firstColumn, boolean convertStringToNumber)
public void importTwoDimensionArray(Object[][] objArray, Object[][] styles, int firstRow, int firstColumn, boolean convertStringToNumber)
Imports a two-dimension array of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
objArray | java.lang.Object[][] | Two-dimension data array. |
styles | java.lang.Object[][] | Two-dimension data style. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
convertStringToNumber | boolean | Indicates if this method will try to convert string to number. |
importTwoDimensionArray(Object[][] objArray, Object[][] styles, int firstRow, int firstColumn, TxtLoadOptions opts)
public void importTwoDimensionArray(Object[][] objArray, Object[][] styles, int firstRow, int firstColumn, TxtLoadOptions opts)
Imports a two-dimension array of data into a worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
objArray | java.lang.Object[][] | Two-dimension data array. |
styles | java.lang.Object[][] | Two-dimension data style. |
firstRow | int | The row number of the first cell to import in. |
firstColumn | int | The column number of the first cell to import in. |
opts | TxtLoadOptions | Options for converting string values |
insertColumn(int columnIndex)
public void insertColumn(int columnIndex)
Inserts a new column into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Column index. |
insertColumn(int columnIndex, boolean updateReference)
public void insertColumn(int columnIndex, boolean updateReference)
Inserts a new column into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Column index. |
updateReference | boolean | Indicates if references in other worksheets will be updated. |
insertColumns(int columnIndex, int totalColumns)
public void insertColumns(int columnIndex, int totalColumns)
Inserts some columns into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Column index. |
totalColumns | int | The number of columns. |
insertColumns(int columnIndex, int totalColumns, boolean updateReference)
public void insertColumns(int columnIndex, int totalColumns, boolean updateReference)
Inserts some columns into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Column index. |
totalColumns | int | The number of columns. |
updateReference | boolean | Indicates if references in other worksheets will be updated. |
insertColumns(int columnIndex, int totalColumns, InsertOptions options)
public void insertColumns(int columnIndex, int totalColumns, InsertOptions options)
Inserts some columns into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | Column index. |
totalColumns | int | The number of columns. |
options | InsertOptions | The options for inserting operation. |
insertCutCells(Range cutRange, int row, int column, int shiftType)
public void insertCutCells(Range cutRange, int row, int column, int shiftType)
Insert cut range.
Parameters:
Parameter | Type | Description |
---|---|---|
cutRange | Range | The cut range. |
row | int | The row. |
column | int | The column. |
shiftType | int | ShiftType. The shift type . |
insertRange(CellArea area, int shiftType)
public void insertRange(CellArea area, int shiftType)
Inserts a range of cells and shift cells according to the shift option.
Parameters:
Parameter | Type | Description |
---|---|---|
area | CellArea | Shift area. |
shiftType | int | ShiftType. Shift cells option. |
insertRange(CellArea area, int shiftNumber, int shiftType)
public void insertRange(CellArea area, int shiftNumber, int shiftType)
Inserts a range of cells and shift cells according to the shift option.
Parameters:
Parameter | Type | Description |
---|---|---|
area | CellArea | Shift area. |
shiftNumber | int | Number of rows or columns to be inserted. |
shiftType | int | ShiftType. Shift cells option. |
insertRange(CellArea area, int shiftNumber, int shiftType, boolean updateReference)
public void insertRange(CellArea area, int shiftNumber, int shiftType, boolean updateReference)
Inserts a range of cells and shift cells according to the shift option.
Parameters:
Parameter | Type | Description |
---|---|---|
area | CellArea | Shift area. |
shiftNumber | int | Number of rows or columns to be inserted. |
shiftType | int | ShiftType. Shift cells option. |
updateReference | boolean | Indicates whether update references in other worksheets. |
insertRow(int rowIndex)
public void insertRow(int rowIndex)
Inserts a new row into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Row index. |
insertRows(int rowIndex, int totalRows)
public void insertRows(int rowIndex, int totalRows)
Inserts multiple rows into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Row index. |
totalRows | int | Number of rows to be inserted. |
insertRows(int rowIndex, int totalRows, boolean updateReference)
public void insertRows(int rowIndex, int totalRows, boolean updateReference)
Inserts multiple rows into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Row index. |
totalRows | int | Number of rows to be inserted. |
updateReference | boolean | Indicates if references in other worksheets will be updated. |
insertRows(int rowIndex, int totalRows, InsertOptions options)
public void insertRows(int rowIndex, int totalRows, InsertOptions options)
Inserts multiple rows into the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | Row index. |
totalRows | int | Number of rows to be inserted. |
options | InsertOptions | Options for inserting operation. |
isBlankColumn(int columnIndex)
public boolean isBlankColumn(int columnIndex)
Checks whether given column is blank(does not contain any data).
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | the column index |
Returns: boolean - true if given column does not contain any data
isColumnHidden(int columnIndex)
public boolean isColumnHidden(int columnIndex)
Checks whether a column at given index is hidden.
Parameters:
Parameter | Type | Description |
---|---|---|
columnIndex | int | column index |
Returns: boolean - true if the column is hidden.
isDefaultRowHeightMatched()
public boolean isDefaultRowHeightMatched()
Indicates that row height and default font height matches
Returns: boolean
isDefaultRowHidden()
public boolean isDefaultRowHidden()
Indicates whether the row is default hidden.
Returns: boolean
isDeletingRangeEnabled(int startRow, int startColumn, int totalRows, int totalColumns)
public boolean isDeletingRangeEnabled(int startRow, int startColumn, int totalRows, int totalColumns)
Check whether the range could be deleted.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | The start row index of the range. |
startColumn | int | The start column index of the range. |
totalRows | int | The number of the rows in the range. |
totalColumns | int | The number of the columns in the range. |
Returns: boolean -
isRowHidden(int rowIndex)
public boolean isRowHidden(int rowIndex)
Checks whether a row at given index is hidden.
Parameters:
Parameter | Type | Description |
---|---|---|
rowIndex | int | row index |
Returns: boolean - true if the row is hidden
iterator()
public Iterator iterator()
Gets the cells enumerator.
Remarks
When traversing elements by the returned Enumerator, the cells collection should not be modified(such as operations that will cause new Cell/Row be instantiated or existing Cell/Row be deleted). Otherwise the enumerator may not be able to traverse all cells correctly(some elements may be traversed repeatedly or skipped).
Example
Workbook workbook = new Workbook("template.xlsx");
Cells cells = workbook.getWorksheets().get(0).getCells();
Iterator en = cells.iterator();
while (en.hasNext())
{
Cell cell = (Cell)en.next();
System.out.println(cell.getName() + ": " + cell.getValue());
}
Returns: java.util.Iterator - The cells enumerator
linkToXmlMap(String mapName, int row, int column, String path)
public void linkToXmlMap(String mapName, int row, int column, String path)
Link to a xml map.
Parameters:
Parameter | Type | Description |
---|---|---|
mapName | java.lang.String | name of xml map |
row | int | row of the destination cell |
column | int | column of the destination cell |
path | java.lang.String | path of xml element in xml map |
merge(int firstRow, int firstColumn, int totalRows, int totalColumns)
public void merge(int firstRow, int firstColumn, int totalRows, int totalColumns)
Merges a specified range of cells into a single cell.
Remarks
Reference the merged cell via the address of the upper-left cell in the range.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | First row of this range(zero based) |
firstColumn | int | First column of this range(zero based) |
totalRows | int | Number of rows(one based) |
totalColumns | int | Number of columns(one based) |
merge(int firstRow, int firstColumn, int totalRows, int totalColumns, boolean mergeConflict)
public void merge(int firstRow, int firstColumn, int totalRows, int totalColumns, boolean mergeConflict)
Merges a specified range of cells into a single cell.
Remarks
Reference the merged cell via the address of the upper-left cell in the range. If mergeConflict is true and the merged range conflicts with other merged cells, other merged cells will be automatically removed.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | First row of this range(zero based) |
firstColumn | int | First column of this range(zero based) |
totalRows | int | Number of rows(one based) |
totalColumns | int | Number of columns(one based) |
mergeConflict | boolean | Merge conflict merged ranges. |
merge(int firstRow, int firstColumn, int totalRows, int totalColumns, boolean checkConflict, boolean mergeConflict)
public void merge(int firstRow, int firstColumn, int totalRows, int totalColumns, boolean checkConflict, boolean mergeConflict)
Merges a specified range of cells into a single cell.
Remarks
Reference the merged cell via the address of the upper-left cell in the range. If mergeConflict is true and the merged range conflicts with other merged cells, other merged cells will be automatically removed.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | First row of this range(zero based) |
firstColumn | int | First column of this range(zero based) |
totalRows | int | Number of rows(one based) |
totalColumns | int | Number of columns(one based) |
checkConflict | boolean | Indicates whether check the merged cells intersects other merged cells |
mergeConflict | boolean | Merge conflict merged ranges. |
moveRange(CellArea sourceArea, int destRow, int destColumn)
public void moveRange(CellArea sourceArea, int destRow, int destColumn)
Moves the range.
Parameters:
Parameter | Type | Description |
---|---|---|
sourceArea | CellArea | The range which should be moved. |
destRow | int | The dest row. |
destColumn | int | The dest column. |
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
removeDuplicates()
public void removeDuplicates()
Removes duplicate rows in the sheet.
removeDuplicates(int startRow, int startColumn, int endRow, int endColumn)
public void removeDuplicates(int startRow, int startColumn, int endRow, int endColumn)
Removes duplicate values in the range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | The start row. |
startColumn | int | The start column |
endRow | int | The end row index. |
endColumn | int | The end column index. |
removeDuplicates(int startRow, int startColumn, int endRow, int endColumn, boolean hasHeaders, int[] columnOffsets)
public void removeDuplicates(int startRow, int startColumn, int endRow, int endColumn, boolean hasHeaders, int[] columnOffsets)
Removes duplicate data of the range.
Parameters:
Parameter | Type | Description |
---|---|---|
startRow | int | The start row. |
startColumn | int | The start column |
endRow | int | The end row index. |
endColumn | int | The end column index. |
hasHeaders | boolean | Indicates whether the range contains headers. |
columnOffsets | int[] | The column offsets. |
removeFormulas()
public void removeFormulas()
Removes all formula and replaces with the value of the formula.
retrieveSubtotalSetting(CellArea ca)
public SubtotalSetting retrieveSubtotalSetting(CellArea ca)
Retrieves subtotals setting of the range.
Parameters:
Parameter | Type | Description |
---|---|---|
ca | CellArea | The range |
Returns: SubtotalSetting -
setColumnWidth(int column, double width)
public void setColumnWidth(int column, double width)
Sets the width of the specified column in normal view.
Remarks
To hide a column, sets column width to zero.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
width | double | Width of column.Column width must be between 0 and 255. |
setColumnWidthInch(int column, double inches)
public void setColumnWidthInch(int column, double inches)
Sets column width in unit of inches in normal view.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
inches | double | Number of inches. |
setColumnWidthPixel(int column, int pixels)
public void setColumnWidthPixel(int column, int pixels)
Sets column width in unit of pixels in normal view.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
pixels | int | Number of pixels. |
setDefaultRowHeightMatched(boolean value)
public void setDefaultRowHeightMatched(boolean value)
Indicates that row height and default font height matches
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setDefaultRowHidden(boolean value)
public void setDefaultRowHidden(boolean value)
Indicates whether the row is default hidden.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setMemorySetting(int value)
public void setMemorySetting(int value)
Sets the memory usage option for this cells.
See MemorySetting.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setMultiThreadReading(boolean value)
public void setMultiThreadReading(boolean value)
Sets whether the cells data model should support Multi-Thread reading. Default value of this property is false.
Remarks
If there are multiple threads to read Row/Cell objects in this collection concurrently, this property should be set as true, otherwise unexpected result may be produced. Supporting Multi-Thread reading may degrade the performance for accessing Row/Cell objects from this collection. Please note, some features cannot support Multi-Thread reading, such as formatting values(by Cell.getStringValue(), Cell.getDisplayStringValue(), .etc.). So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setPreserveString(boolean value)
public void setPreserveString(boolean value)
Sets a value indicating whether all worksheet values are preserved as strings. Default is false.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
setRowHeight(int row, double height)
public void setRowHeight(int row, double height)
Sets the height of the specified row.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
height | double | Height of row.In unit of point It should be between 0 and 409.5. |
setRowHeightInch(int row, double inches)
public void setRowHeightInch(int row, double inches)
Sets row height in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
inches | double | Number of inches. It should be between 0 and 409.5/72. |
setRowHeightPixel(int row, int pixels)
public void setRowHeightPixel(int row, int pixels)
Sets row height in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
pixels | int | Number of pixels. |
setStandardHeight(double value)
public void setStandardHeight(double value)
Sets the default row height in this worksheet, in unit of points.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setStandardHeightInch(double value)
public void setStandardHeightInch(double value)
Sets the default row height in this worksheet, in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setStandardHeightPixels(int value)
public void setStandardHeightPixels(int value)
Sets the default row height in this worksheet, in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setStandardWidth(double value)
public void setStandardWidth(double value)
Sets the default column width in the worksheet, in unit of characters.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setStandardWidthInch(double value)
public void setStandardWidthInch(double value)
Sets the default column width in the worksheet, in unit of inches.
Parameters:
Parameter | Type | Description |
---|---|---|
value | double |
setStandardWidthPixels(int value)
public void setStandardWidthPixels(int value)
Sets the default column width in the worksheet, in unit of pixels.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setStyle(Style value)
public void setStyle(Style value)
Sets the default style of the worksheet.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Style |
setViewColumnWidthPixel(int column, int pixels)
public void setViewColumnWidthPixel(int column, int pixels)
Sets the width of the column in different view.
Remarks
If the current view type is ViewType.PAGE_LAYOUT_VIEW, the column’s width is same as printed width.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | The column index. |
pixels | int | The width in unit of pixels. |
showGroupDetail(boolean isVertical, int index)
public void showGroupDetail(boolean isVertical, int index)
Expands the grouped rows/columns.
Parameters:
Parameter | Type | Description |
---|---|---|
isVertical | boolean | True, expands the grouped rows. |
index | int | The row/column index |
subtotal(CellArea ca, int groupBy, int function, int[] totalList)
public void subtotal(CellArea ca, int groupBy, int function, int[] totalList)
Creates subtotals for the range.
Parameters:
Parameter | Type | Description |
---|---|---|
ca | CellArea | The range |
groupBy | int | The field to group by, as a zero-based integer offset |
function | int | ConsolidationFunction. The subtotal function. |
totalList | int[] | An array of zero-based field offsets, indicating the fields to which the subtotals are added. |
subtotal(CellArea ca, int groupBy, int function, int[] totalList, boolean replace, boolean pageBreaks, boolean summaryBelowData)
public void subtotal(CellArea ca, int groupBy, int function, int[] totalList, boolean replace, boolean pageBreaks, boolean summaryBelowData)
Creates subtotals for the range.
Parameters:
Parameter | Type | Description |
---|---|---|
ca | CellArea | The range |
groupBy | int | The field to group by, as a zero-based integer offset |
function | int | ConsolidationFunction. The subtotal function. |
totalList | int[] | An array of zero-based field offsets, indicating the fields to which the subtotals are added. |
replace | boolean | Indicates whether replace the current subtotals |
pageBreaks | boolean | Indicates whether add page break between groups |
summaryBelowData | boolean | Indicates whether add summary below data. |
textToColumns(int row, int column, int totalRows, TxtLoadOptions options)
public int textToColumns(int row, int column, int totalRows, TxtLoadOptions options)
Splits content in specified column into multiple columns..
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | The row index. |
column | int | The column index. |
totalRows | int | The number of rows. |
options | TxtLoadOptions | The split options. |
Returns: int - Total column count of the split values.
toString()
public String toString()
Returns: java.lang.String
unMerge(int firstRow, int firstColumn, int totalRows, int totalColumns)
public void unMerge(int firstRow, int firstColumn, int totalRows, int totalColumns)
Unmerges a specified range of merged cells.
Parameters:
Parameter | Type | Description |
---|---|---|
firstRow | int | First row of this range(zero based) |
firstColumn | int | First column of this range(zero based) |
totalRows | int | Number of rows(one based) |
totalColumns | int | Number of columns(one based) |
ungroupColumns(int firstIndex, int lastIndex)
public void ungroupColumns(int firstIndex, int lastIndex)
Ungroups columns.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first column index to be ungrouped. |
lastIndex | int | The last column index to be ungrouped. |
ungroupRows(int firstIndex, int lastIndex)
public void ungroupRows(int firstIndex, int lastIndex)
Ungroups rows.
Remarks
Only removes outer group info.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first row index to be ungrouped. |
lastIndex | int | The last row index to be ungrouped. |
ungroupRows(int firstIndex, int lastIndex, boolean isAll)
public void ungroupRows(int firstIndex, int lastIndex, boolean isAll)
Ungroups rows.
Parameters:
Parameter | Type | Description |
---|---|---|
firstIndex | int | The first row index to be ungrouped. |
lastIndex | int | The last row index to be ungrouped. |
isAll | boolean | True, removes all grouped info.Otherwise, remove the outer group info. |
unhideColumn(int column, double width)
public void unhideColumn(int column, double width)
Unhides a column
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
width | double | Column width. |
unhideColumns(int column, int totalColumns, double width)
public void unhideColumns(int column, int totalColumns, double width)
Unhide multiple columns.
Remarks
Only applies the column width to the hidden columns.
Parameters:
Parameter | Type | Description |
---|---|---|
column | int | Column index. |
totalColumns | int | Column number |
width | double | Column width. |
unhideRow(int row, double height)
public void unhideRow(int row, double height)
Unhides a row.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | Row index. |
height | double | Row height. The row’s height will be changed only when the row is hidden and given height value is positive. |
unhideRows(int row, int totalRows, double height)
public void unhideRows(int row, int totalRows, double height)
Unhides the hidden rows.
Parameters:
Parameter | Type | Description |
---|---|---|
row | int | The row index. |
totalRows | int | The row number. |
height | double | Row height. The row’s height will be changed only when the row is hidden and given height value is positive. |
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |