public class Cells
extends java.lang.Object
implements java.lang.Iterable
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);
| Modifier and Type | Method and Description |
|---|---|
void |
addRange(Range rangeObject)
Adds a range object reference to cells
|
void |
applyColumnStyle(int column,
Style style,
StyleFlag flag)
Applies formats for a whole column.
|
void |
applyRowStyle(int row,
Style style,
StyleFlag flag)
Applies formats for a whole row.
|
void |
applyStyle(Style style,
StyleFlag flag)
Applies formats for a whole worksheet.
|
Cell |
checkCell(int row,
int column)
Gets the
Cell element or null at the specified cell row index and column index. |
Column |
checkColumn(int columnIndex)
Gets the
Column element or null at the specified column index. |
Row |
checkRow(int row)
Gets the
Row element or null at the specified cell row index. |
void |
clear()
Clears all data of the worksheet.
|
void |
clearContents(CellArea range)
Clears contents of a range.
|
void |
clearContents(int startRow,
int startColumn,
int endRow,
int endColumn)
Clears contents of a range.
|
void |
clearFormats(CellArea range)
Clears formatting of a range.
|
void |
clearFormats(int startRow,
int startColumn,
int endRow,
int endColumn)
Clears formatting of a range.
|
void |
clearMergedCells()
Clears all merged ranges.
|
void |
clearRange(CellArea range)
Clears contents and formatting of a range.
|
void |
clearRange(int startRow,
int startColumn,
int endRow,
int endColumn)
Clears contents and formatting of a range.
|
void |
convertStringToNumericValue()
Converts all string data in the worksheet to numeric value if possible.
|
void |
copyColumn(Cells sourceCells,
int sourceColumnIndex,
int destinationColumnIndex)
Copies data and formats of a whole column.
|
void |
copyColumns(Cells sourceCells0,
int sourceColumnIndex,
int destinationColumnIndex,
int columnNumber)
Copies data and formats of a whole column.
|
void |
copyColumns(Cells sourceCells,
int sourceColumnIndex,
int sourceTotalColumns,
int destinationColumnIndex,
int destinationTotalColumns)
Copies data and formats of the whole columns.
|
void |
copyColumns(Cells sourceCells0,
int sourceColumnIndex,
int destinationColumnIndex,
int columnNumber,
PasteOptions pasteOptions)
Copies data and formats of a whole column.
|
void |
copyRow(Cells sourceCells,
int sourceRowIndex,
int destinationRowIndex)
Copies data and formats of a whole row.
|
void |
copyRows(Cells sourceCells,
int sourceRowIndex,
int destinationRowIndex,
int rowNumber)
Copies data and formats of some whole rows.
|
void |
copyRows(Cells sourceCells0,
int sourceRowIndex,
int destinationRowIndex,
int rowNumber,
CopyOptions copyOptions)
Copies data and formats of some whole rows.
|
void |
copyRows(Cells sourceCells0,
int sourceRowIndex,
int destinationRowIndex,
int rowNumber,
CopyOptions copyOptions,
PasteOptions pasteOptions)
Copies data and formats of some whole rows.
|
Range |
createRange(int firstIndex,
int number,
boolean isVertical)
Creates a
Range object from rows of cells or columns of cells. |
Range |
createRange(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Creates a
Range object from a range of cells. |
Range |
createRange(java.lang.String address)
Creates a
Range object from an address of the range. |
Range |
createRange(java.lang.String upperLeftCell,
java.lang.String lowerRightCell)
Creates a
Range object from a range of cells. |
void |
deleteBlankColumns()
Delete all blank columns which do not contain any data.
|
void |
deleteBlankColumns(DeleteOptions options)
Delete all blank columns which do not contain any data.
|
void |
deleteBlankRows()
Delete all blank rows which do not contain any data or other object.
|
void |
deleteBlankRows(DeleteOptions options)
Delete all blank rows which do not contain any data or some special objects such as visible comment, pivot table.
|
void |
deleteColumn(int columnIndex)
Deletes a column.
|
void |
deleteColumn(int columnIndex,
boolean updateReference)
Deletes a column.
|
void |
deleteColumns(int columnIndex,
int totalColumns,
boolean updateReference)
Deletes several columns.
|
void |
deleteColumns(int columnIndex,
int totalColumns,
DeleteOptions options)
Deletes several columns.
|
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.
|
void |
deleteRow(int rowIndex)
Deletes a row.
|
void |
deleteRow(int rowIndex,
boolean updateReference)
Deletes a row.
|
boolean |
deleteRows(int rowIndex,
int totalRows)
Deletes multiple rows.
|
boolean |
deleteRows(int rowIndex,
int totalRows,
boolean updateReference)
Deletes multiple rows in the worksheet.
|
boolean |
deleteRows(int rowIndex,
int totalRows,
DeleteOptions options)
Deletes multiple rows in the worksheet.
|
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or
resetting unmanaged resources.
|
Cell |
endCellInColumn(int columnIndex)
Gets the last cell in this column.
|
Cell |
endCellInColumn(int startRow,
int endRow,
int startColumn,
int endColumn)
Gets the last cell with maximum column index in this range.
|
Cell |
endCellInRow(int rowIndex)
Gets the last cell in this row.
|
Cell |
endCellInRow(int startRow,
int endRow,
int startColumn,
int endColumn)
Gets the last cell with maximum row index in this range.
|
java.lang.Object[][] |
exportArray(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Exports data in the
Cells collection to a two-dimension array object. |
int[][] |
exportTypeArray(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Exports cell value type in the
Cells collection to a two-dimension array object. |
Cell |
find(java.lang.Object what,
Cell previousCell)
Finds the cell containing with the input object.
|
Cell |
find(java.lang.Object what,
Cell previousCell,
FindOptions findOptions)
Finds the cell containing with the input object.
|
Cell |
get(int row,
int column)
Gets the
Cell element at the specified cell row index and column index. |
Cell |
get(java.lang.String cellName)
Gets the
Cell element at the specified cell name. |
Style |
getCellDisplayStyle(int row,
int column)
Get the display style of given cell.
|
Style |
getCellDisplayStyle(int row,
int column,
int adjacentBorders)
Get the display style of given cell.
|
Style |
getCellStyle(int row,
int column)
Get the style of given cell.
|
java.util.Iterator |
getCellsWithPlaceInCellPicture()
Gets all cells that contain embedded picture.
|
double |
getColumnOriginalWidthPoint(int column)
Deprecated.
Use Cells.GetColumnWidth(int ,bool , CellsUnitType ) method, instead.
|
ColumnCollection |
getColumns()
Gets the collection of
Column objects that represents the individual columns in this worksheet. |
double |
getColumnWidth(int column)
Gets the width(in unit of characters) of the specified column in normal view
|
double |
getColumnWidth(int column,
boolean isOriginal,
int unitType)
Gets the column width.
|
double |
getColumnWidthInch(int column)
Deprecated.
Use Cells.GetColumnWidth(int ,bool , CellsUnitType ) method, instead.
|
int |
getColumnWidthPixel(int column)
Gets the width of the specified column in normal view, in units of pixel.
|
int |
getColumnWidthPixel(int column,
boolean original)
Deprecated.
Use Cells.GetColumnWidth(int ,bool , CellsUnitType ) method, instead.
|
int |
getCount()
Gets the total count of instantiated Cell objects.
|
long |
getCountLarge()
Gets the total count of instantiated Cell objects.
|
Cell[] |
getDependents(boolean isAll,
int row,
int column)
Get all cells which refer to the specific cell.
|
java.util.Iterator |
getDependentsInCalculation(int row,
int column,
boolean recursive)
Gets all cells whose calculated result depends on specific cell.
|
Cell |
getFirstCell()
Gets the first cell in this worksheet.
|
int |
getFirstDataRow(int column)
Gets the first row index of cell which contains data in the specified column.
|
int |
getGroupedColumnOutlineLevel(int columnIndex)
Gets the outline level (zero-based) of the column.
|
int |
getGroupedRowOutlineLevel(int rowIndex)
Gets the outline level (zero-based) of the row.
|
Cell |
getLastCell()
Gets the last cell in this worksheet.
|
int |
getLastDataRow(int column)
Gets the last row index of cell which contains data in the specified column.
|
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).
|
int |
getMaxDataColumn()
Maximum column index of cell which contains data.
|
int |
getMaxDataRow()
Maximum row index of cell which contains data.
|
Range |
getMaxDisplayRange()
Gets the max range which includes data, merged cells and shapes.
|
int |
getMaxGroupedColumnOutlineLevel()
Gets the max grouped column outline level (zero-based).
|
int |
getMaxGroupedRowOutlineLevel()
Gets the max grouped row outline level (zero-based).
|
int |
getMaxRow()
Maximum row index of cell which contains data or style.
|
int |
getMemorySetting()
Gets the memory usage option for this cells.
|
CellArea[] |
getMergedAreas()
Gets all merged cells.
|
java.util.ArrayList |
getMergedCells()
Deprecated.
Use Cells.GetMergedAreas() instead.
|
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).
|
int |
getMinDataColumn()
Minimum column index of cell which contains data.
|
int |
getMinDataRow()
Minimum row index of cell which contains data.
|
int |
getMinRow()
Minimum row index of cell which contains data or style.
|
boolean |
getMultiThreadReading()
Gets whether the cells data model should support Multi-Thread reading.
|
OdsCellFieldCollection |
getOdsCellFields()
Gets the list of fields of ods.
|
boolean |
getPreserveString()
Gets a value indicating whether all worksheet values are preserved as strings.
|
RangeCollection |
getRanges()
Gets the collection of
Range objects created at run time. |
java.util.Iterator |
getRowEnumerator()
Deprecated.
Use RowCollection.GetEnumerator() method, instead.
|
double |
getRowHeight(int row)
Gets the height of a specified row, in unit of points.
|
double |
getRowHeight(int row,
boolean isOriginal,
int unitType)
Gets row's height.
|
double |
getRowHeightInch(int row)
Gets the height of a specified row in unit of inches.
|
int |
getRowHeightPixel(int row)
Gets the height of a specified row in unit of pixel.
|
double |
getRowOriginalHeightPoint(int row)
Deprecated.
Use Cells.GetRowHeight(int,bool,CellsUnitType) method, instead.
|
RowCollection |
getRows()
Gets the collection of
Row objects that represents the individual rows in this worksheet. |
double |
getStandardHeight()
Gets the default row height in this worksheet, in unit of points.
|
double |
getStandardHeightInch()
Gets the default row height in this worksheet, in unit of inches.
|
int |
getStandardHeightPixels()
Gets the default row height in this worksheet, in unit of pixels.
|
double |
getStandardWidth()
Gets the default column width in the worksheet, in unit of characters.
|
double |
getStandardWidthInch()
Gets the default column width in the worksheet, in unit of inches.
|
int |
getStandardWidthPixels()
Gets the default column width in the worksheet, in unit of pixels.
|
Style |
getStyle()
Gets the default style of the worksheet.
|
int |
getViewColumnWidthPixel(int column)
Get the width in different view type.
|
double |
getViewRowHeight(int row)
Gets the height of a specified row.
|
double |
getViewRowHeightInch(int row)
Gets the height of a specified row in unit of inches.
|
void |
groupColumns(int firstIndex,
int lastIndex)
Groups columns.
|
void |
groupColumns(int firstIndex,
int lastIndex,
boolean isHidden)
Groups columns.
|
void |
groupRows(int firstIndex,
int lastIndex)
Groups rows.
|
void |
groupRows(int firstIndex,
int lastIndex,
boolean isHidden)
Groups rows.
|
void |
hideColumn(int column)
Hides a column.
|
void |
hideColumns(int column,
int totalColumns)
Hide multiple columns.
|
void |
hideGroupDetail(boolean isVertical,
int index)
Collapses the grouped rows/columns.
|
void |
hideRow(int row)
Hides a row.
|
void |
hideRows(int row,
int totalRows)
Hides multiple rows.
|
void |
importArray(double[][] doubleArray,
int firstRow,
int firstColumn)
Imports a two-dimension array of double into a worksheet.
|
void |
importArray(double[] doubleArray,
int firstRow,
int firstColumn,
boolean isVertical)
Imports an array of double into a worksheet.
|
void |
importArray(int[][] intArray,
int firstRow,
int firstColumn)
Imports a two-dimension array of integer into a worksheet.
|
void |
importArray(int[] intArray,
int firstRow,
int firstColumn,
boolean isVertical)
Imports an array of integer into a worksheet.
|
void |
importArray(java.lang.String[][] stringArray,
int firstRow,
int firstColumn)
Imports a two-dimension array of string into a worksheet.
|
void |
importArray(java.lang.String[] stringArray,
int firstRow,
int firstColumn,
boolean isVertical)
Imports an array of string into a worksheet.
|
void |
importArrayList(java.util.ArrayList arrayList,
int firstRow,
int firstColumn,
boolean isVertical)
Imports an arraylist of data into a worksheet.
|
void |
importCSV(java.io.InputStream stream,
java.lang.String splitter,
boolean convertNumericData,
int firstRow,
int firstColumn)
Import a CSV file to the cells.
|
void |
importCSV(java.io.InputStream stream,
TxtLoadOptions options,
int firstRow,
int firstColumn)
Import a CSV file to the cells.
|
void |
importCSV(java.lang.String fileName,
java.lang.String splitter,
boolean convertNumericData,
int firstRow,
int firstColumn)
Import a CSV file to the cells.
|
void |
importCSV(java.lang.String fileName,
TxtLoadOptions options,
int firstRow,
int firstColumn)
Import a CSV file to the cells.
|
int |
importCustomObjects(java.util.Collection list,
int firstRow,
int firstColumn,
ImportTableOptions options)
Imports custom objects.
|
int |
importCustomObjects(java.util.Collection list,
java.lang.String[] propertyNames,
boolean isPropertyNameShown,
int firstRow,
int firstColumn,
int rowNumber,
boolean insertRows,
java.lang.String dateFormatString,
boolean convertStringToNumber)
Imports custom objects.
|
int |
importData(ICellsDataTable table,
int firstRow,
int firstColumn,
ImportTableOptions options)
Import data from custom data table.
|
void |
importFormulaArray(java.lang.String[] stringArray,
int firstRow,
int firstColumn,
boolean isVertical)
Imports an array of formula into a worksheet.
|
void |
importObjectArray(java.lang.Object[] objArray,
int firstRow,
int firstColumn,
boolean isVertical)
Imports an array of data into a worksheet.
|
void |
importObjectArray(java.lang.Object[] objArray,
int firstRow,
int firstColumn,
boolean isVertical,
int skip)
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,
ImportTableOptions options)
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,
ImportTableOptions options)
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 |
importTwoDimensionArray(java.lang.Object[][] objArray,
int firstRow,
int firstColumn)
Imports a two-dimension array of data into a worksheet.
|
void |
importTwoDimensionArray(java.lang.Object[][] objArray,
int firstRow,
int firstColumn,
boolean convertStringToNumber)
Imports a two-dimension array of data into a worksheet.
|
void |
importTwoDimensionArray(java.lang.Object[][] objArray,
java.lang.Object[][] styles,
int firstRow,
int firstColumn,
boolean convertStringToNumber)
Imports a two-dimension array of data into a worksheet.
|
void |
importTwoDimensionArray(java.lang.Object[][] objArray,
java.lang.Object[][] styles,
int firstRow,
int firstColumn,
TxtLoadOptions opts)
Imports a two-dimension array of data into a worksheet.
|
void |
insertColumn(int columnIndex)
Inserts a new column into the worksheet.
|
void |
insertColumn(int columnIndex,
boolean updateReference)
Inserts a new column into the worksheet.
|
void |
insertColumns(int columnIndex,
int totalColumns)
Inserts some columns into the worksheet.
|
void |
insertColumns(int columnIndex,
int totalColumns,
boolean updateReference)
Inserts some columns into the worksheet.
|
void |
insertColumns(int columnIndex,
int totalColumns,
InsertOptions options)
Inserts some columns into the worksheet.
|
void |
insertCutCells(Range cutRange,
int row,
int column,
int shiftType)
Insert cut range.
|
void |
insertRange(CellArea area,
int shiftType)
Inserts a range of cells and shift cells according to the shift option.
|
void |
insertRange(CellArea area,
int shiftNumber,
int shiftType)
Inserts a range of cells and shift cells according to the shift option.
|
void |
insertRange(CellArea area,
int shiftNumber,
int shiftType,
boolean updateReference)
Inserts a range of cells and shift cells according to the shift option.
|
void |
insertRow(int rowIndex)
Inserts a new row into the worksheet.
|
void |
insertRows(int rowIndex,
int totalRows)
Inserts multiple rows into the worksheet.
|
void |
insertRows(int rowIndex,
int totalRows,
boolean updateReference)
Inserts multiple rows into the worksheet.
|
void |
insertRows(int rowIndex,
int totalRows,
InsertOptions options)
Inserts multiple rows into the worksheet.
|
boolean |
isBlankColumn(int columnIndex)
Checks whether given column is blank(does not contain any data).
|
boolean |
isColumnHidden(int columnIndex)
Checks whether a column at given index is hidden.
|
boolean |
isDefaultColumnHidden() |
boolean |
isDefaultRowHeightMatched()
Indicates that row height and default font height matches
|
boolean |
isDefaultRowHidden()
Indicates whether the row is default hidden.
|
boolean |
isDeletingRangeEnabled(int startRow,
int startColumn,
int totalRows,
int totalColumns)
Check whether the range could be deleted.
|
boolean |
isRowHidden(int rowIndex)
Checks whether a row at given index is hidden.
|
java.util.Iterator |
iterator()
Gets the cells enumerator.
|
void |
linkToXmlMap(java.lang.String mapName,
int row,
int column,
java.lang.String path)
Link to a xml map.
|
void |
merge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Merges a specified range of cells into a single cell.
|
void |
merge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns,
boolean mergeConflict)
Merges a specified range of cells into a single cell.
|
void |
merge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns,
boolean checkConflict,
boolean mergeConflict)
Merges a specified range of cells into a single cell.
|
void |
moveRange(CellArea sourceArea,
int destRow,
int destColumn)
Moves the range.
|
void |
removeDuplicates()
Removes duplicate rows in the sheet.
|
void |
removeDuplicates(int startRow,
int startColumn,
int endRow,
int endColumn)
Removes duplicate values in the range.
|
void |
removeDuplicates(int startRow,
int startColumn,
int endRow,
int endColumn,
boolean hasHeaders,
int[] columnOffsets)
Removes duplicate data of the range.
|
void |
removeFormulas()
Removes all formula and replaces with the value of the formula.
|
SubtotalSetting |
retrieveSubtotalSetting(CellArea ca)
Retrieves subtotals setting of the range.
|
void |
setColumnWidth(int column,
double width)
Sets the width of the specified column in normal view.
|
void |
setColumnWidthInch(int column,
double inches)
Sets column width in unit of inches in normal view.
|
void |
setColumnWidthPixel(int column,
int pixels)
Sets column width in unit of pixels in normal view.
|
void |
setDefaultColumnHidden(boolean value) |
void |
setDefaultRowHeightMatched(boolean value)
Indicates that row height and default font height matches
|
void |
setDefaultRowHidden(boolean value)
Indicates whether the row is default hidden.
|
void |
setMemorySetting(int value)
Sets the memory usage option for this cells.
|
void |
setMultiThreadReading(boolean value)
Sets whether the cells data model should support Multi-Thread reading.
|
void |
setPreserveString(boolean value)
Sets a value indicating whether all worksheet values are preserved as strings.
|
void |
setRowHeight(int row,
double height)
Sets the height of the specified row.
|
void |
setRowHeightInch(int row,
double inches)
Sets row height in unit of inches.
|
void |
setRowHeightPixel(int row,
int pixels)
Sets row height in unit of pixels.
|
void |
setStandardHeight(double value)
Sets the default row height in this worksheet, in unit of points.
|
void |
setStandardHeightInch(double value)
Sets the default row height in this worksheet, in unit of inches.
|
void |
setStandardHeightPixels(int value)
Sets the default row height in this worksheet, in unit of pixels.
|
void |
setStandardWidth(double value)
Sets the default column width in the worksheet, in unit of characters.
|
void |
setStandardWidthInch(double value)
Sets the default column width in the worksheet, in unit of inches.
|
void |
setStandardWidthPixels(int value)
Sets the default column width in the worksheet, in unit of pixels.
|
void |
setStyle(Style value)
Sets the default style of the worksheet.
|
void |
setViewColumnWidthPixel(int column,
int pixels)
Sets the width of the column in different view.
|
void |
showGroupDetail(boolean isVertical,
int index)
Expands the grouped rows/columns.
|
void |
subtotal(CellArea ca,
int groupBy,
int function,
int[] totalList)
Creates subtotals for the range.
|
void |
subtotal(CellArea ca,
int groupBy,
int function,
int[] totalList,
boolean replace,
boolean pageBreaks,
boolean summaryBelowData)
Creates subtotals for the range.
|
int |
textToColumns(int row,
int column,
int totalRows,
TxtLoadOptions options)
Splits content in specified column into multiple columns..
|
void |
ungroupColumns(int firstIndex,
int lastIndex)
Ungroups columns.
|
void |
ungroupRows(int firstIndex,
int lastIndex)
Ungroups rows.
|
void |
ungroupRows(int firstIndex,
int lastIndex,
boolean isAll)
Ungroups rows.
|
void |
unhideColumn(int column,
double width)
Unhides a column
|
void |
unhideColumns(int column,
int totalColumns,
double width)
Unhide multiple columns.
|
void |
unhideRow(int row,
double height)
Unhides a row.
|
void |
unhideRows(int row,
int totalRows,
double height)
Unhides the hidden rows.
|
void |
unMerge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Unmerges a specified range of merged cells.
|
public OdsCellFieldCollection getOdsCellFields()
public void dispose()
public int getCount()
public long getCountLarge()
public java.util.Iterator iterator()
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());
}
iterator in interface java.lang.Iterablepublic java.util.Iterator getRowEnumerator()
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.public RowCollection getRows()
Row objects that represents the individual rows in this worksheet.public java.util.ArrayList getMergedCells()
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.public CellArea[] getMergedAreas()
public Cell checkCell(int row, int column)
Cell element or null at the specified cell row index and column index.row - Row indexcolumn - Column indexpublic Row checkRow(int row)
Row element or null at the specified cell row index.row - Row indexRow object If the row object does exist, otherwise returns null.public Column checkColumn(int columnIndex)
Column element or null at the specified column index.columnIndex - The column index.public boolean isRowHidden(int rowIndex)
rowIndex - row indexpublic boolean isColumnHidden(int columnIndex)
columnIndex - column indexpublic void addRange(Range rangeObject)
rangeObject - The range object will be contained in the cellspublic Range createRange(java.lang.String upperLeftCell, java.lang.String lowerRightCell)
Range object from a range of cells.upperLeftCell - Upper left cell name.lowerRightCell - Lower right cell name.Range objectpublic Range createRange(int firstRow, int firstColumn, int totalRows, int totalColumns)
Range object from a range of cells.firstRow - First row of this rangefirstColumn - First column of this rangetotalRows - Number of rowstotalColumns - Number of columnsRange objectpublic Range createRange(java.lang.String address)
Range object from an address of the range.address - The address of the range.Range objectpublic Range createRange(int firstIndex, int number, boolean isVertical)
Range object from rows of cells or columns of cells.firstIndex - First row index or first 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.Range object.public Cell get(int row, int column)
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"
row - Row index.column - Column index.Cell object.public Cell get(java.lang.String cellName)
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"
cellName - Cell name,including its column letter and row number, for example A5.Cell objectpublic boolean getMultiThreadReading()
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(byCell.getStringValue(), Cell.getDisplayStringValue(), .etc.).
So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.public void setMultiThreadReading(boolean value)
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(byCell.getStringValue(), Cell.getDisplayStringValue(), .etc.).
So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.public int getMemorySetting()
See MemorySetting.
Remarks
Notable limits and recommended operations for some modes:| Mode | Remarks | Supported |
|---|---|---|
MemorySetting.MEMORY_PREFERENCE | Cells data will be maintained in compact format to decrease the memory cost. On other hand, the compact data also may cause higher time cost, especially when updating the cells data, or accessing cells/rows randomly | v8.0.0 |
MemorySetting.FILE_CACHE |
When this mode is used for any worksheet in one workbook, Workbook.dispose()
should be called at the end of work to release all resources such as the temporary files.
Randomly accessing cells will give poor performance because data needs to be read/updated randomly and repeatedly(so the pointer in the file will be changed accordingly and IO operations will be required repeatedly). If possible, please always access the data sequentially(row by row). When the data of one row/cell be changed, data of other cells/rows may also be influenced(such as the data be shifted/moved to other places to allocated enough spaces for the changed data). So every change of every data requires synchronization of other existing objects( such as Row or Cell object). So, to get better performance, please do not maintain multiple Rows/Cells at the same time. Processing them one by one will reduce the data synchronization for them so the performance can be improved a bit. | v25.7 |
public void setMemorySetting(int value)
See MemorySetting.
Remarks
Notable limits and recommended operations for some modes:| Mode | Remarks | Supported |
|---|---|---|
MemorySetting.MEMORY_PREFERENCE | Cells data will be maintained in compact format to decrease the memory cost. On other hand, the compact data also may cause higher time cost, especially when updating the cells data, or accessing cells/rows randomly | v8.0.0 |
MemorySetting.FILE_CACHE |
When this mode is used for any worksheet in one workbook, Workbook.dispose()
should be called at the end of work to release all resources such as the temporary files.
Randomly accessing cells will give poor performance because data needs to be read/updated randomly and repeatedly(so the pointer in the file will be changed accordingly and IO operations will be required repeatedly). If possible, please always access the data sequentially(row by row). When the data of one row/cell be changed, data of other cells/rows may also be influenced(such as the data be shifted/moved to other places to allocated enough spaces for the changed data). So every change of every data requires synchronization of other existing objects( such as Row or Cell object). So, to get better performance, please do not maintain multiple Rows/Cells at the same time. Processing them one by one will reduce the data synchronization for them so the performance can be improved a bit. | v25.7 |
public void clear()
public Style getStyle()
public void setStyle(Style value)
public boolean isDefaultColumnHidden()
public void setDefaultColumnHidden(boolean value)
public double getStandardWidthInch()
public void setStandardWidthInch(double value)
public int getStandardWidthPixels()
public void setStandardWidthPixels(int value)
public double getStandardWidth()
public void setStandardWidth(double value)
public double getStandardHeight()
public void setStandardHeight(double value)
public int getStandardHeightPixels()
public void setStandardHeightPixels(int value)
public double getStandardHeightInch()
public void setStandardHeightInch(double value)
public int importData(ICellsDataTable table, int firstRow, int firstColumn, ImportTableOptions options)
table - The custom data table.firstRow - First row index.firstColumn - First column index.options - The import optionspublic void importTwoDimensionArray(java.lang.Object[][] objArray,
int firstRow,
int firstColumn)
objArray - Two-dimension data array.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.public void importTwoDimensionArray(java.lang.Object[][] objArray,
int firstRow,
int firstColumn,
boolean convertStringToNumber)
objArray - Two-dimension data array.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.convertStringToNumber - Indicates if this method will try to convert string to number.public void importTwoDimensionArray(java.lang.Object[][] objArray,
java.lang.Object[][] styles,
int firstRow,
int firstColumn,
boolean convertStringToNumber)
objArray - Two-dimension data array.styles - Two-dimension data style.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.convertStringToNumber - Indicates if this method will try to convert string to number.public void importTwoDimensionArray(java.lang.Object[][] objArray,
java.lang.Object[][] styles,
int firstRow,
int firstColumn,
TxtLoadOptions opts)
objArray - Two-dimension data array.styles - Two-dimension data style.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.opts - Options for converting string valuespublic void importObjectArray(java.lang.Object[] objArray,
int firstRow,
int firstColumn,
boolean isVertical)
objArray - 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.public void importArrayList(java.util.ArrayList arrayList,
int firstRow,
int firstColumn,
boolean isVertical)
arrayList - Data arraylist.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.public void importObjectArray(java.lang.Object[] objArray,
int firstRow,
int firstColumn,
boolean isVertical,
int skip)
objArray - 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.skip - Skipped number of rows or columns.public void importArray(java.lang.String[][] stringArray,
int firstRow,
int firstColumn)
stringArray - 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.public void importFormulaArray(java.lang.String[] stringArray,
int firstRow,
int firstColumn,
boolean isVertical)
stringArray - Formula 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.public void importArray(java.lang.String[] stringArray,
int firstRow,
int firstColumn,
boolean isVertical)
stringArray - 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.public void importArray(int[][] intArray,
int firstRow,
int firstColumn)
intArray - 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.public void importArray(int[] intArray,
int firstRow,
int firstColumn,
boolean isVertical)
intArray - 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.public void importArray(double[][] doubleArray,
int firstRow,
int firstColumn)
doubleArray - 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.public void importArray(double[] doubleArray,
int firstRow,
int firstColumn,
boolean isVertical)
doubleArray - 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.public int textToColumns(int row,
int column,
int totalRows,
TxtLoadOptions options)
row - The row index.column - The column index.totalRows - The number of rows.options - The split options.public void importCSV(java.lang.String fileName,
java.lang.String splitter,
boolean convertNumericData,
int firstRow,
int firstColumn)
fileName - The CSV file name.splitter - The splitterconvertNumericData - Whether the string in text file is converted to numeric data.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.public void importCSV(java.io.InputStream stream,
java.lang.String splitter,
boolean convertNumericData,
int firstRow,
int firstColumn)
stream - The CSV file stream.splitter - The splitterconvertNumericData - Whether the string in text file is converted to numeric data.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.public void importCSV(java.lang.String fileName,
TxtLoadOptions options,
int firstRow,
int firstColumn)
fileName - The CSV file name.options - The load options for reading text filefirstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.public void importCSV(java.io.InputStream stream,
TxtLoadOptions options,
int firstRow,
int firstColumn)
stream - The CSV file stream.options - The load options for reading text filefirstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.public boolean getPreserveString()
public void setPreserveString(boolean value)
public void merge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Remarks
Reference the merged cell via the address of the upper-left cell in the range.firstRow - First row of this range(zero based)firstColumn - First column of this range(zero based)totalRows - Number of rows(one based)totalColumns - Number of columns(one based)public void merge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns,
boolean mergeConflict)
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.firstRow - First row of this range(zero based)firstColumn - First column of this range(zero based)totalRows - Number of rows(one based)totalColumns - Number of columns(one based)mergeConflict - Merge conflict merged ranges.public void merge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns,
boolean checkConflict,
boolean mergeConflict)
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.firstRow - First row of this range(zero based)firstColumn - First column of this range(zero based)totalRows - Number of rows(one based)totalColumns - Number of columns(one based)checkConflict - Indicates whether check the merged cells intersects other merged cellsmergeConflict - Merge conflict merged ranges.public void unMerge(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
firstRow - First row of this range(zero based)firstColumn - First column of this range(zero based)totalRows - Number of rows(one based)totalColumns - Number of columns(one based)public void clearMergedCells()
public void hideRow(int row)
row - Row index.public void unhideRow(int row,
double height)
row - Row index.height - Row height. The row's height will be changed only when the row is hidden and given height value is positive.public void hideRows(int row,
int totalRows)
row - The row index.totalRows - The row number.public void unhideRows(int row,
int totalRows,
double height)
row - The row index.totalRows - The row number.height - Row height. The row's height will be changed only when the row is hidden and given height value is positive.public void setRowHeightPixel(int row,
int pixels)
row - Row index.pixels - Number of pixels.public void setRowHeightInch(int row,
double inches)
row - Row index.inches - Number of inches. It should be between 0 and 409.5/72.public void setRowHeight(int row,
double height)
row - Row index.height - Height of row.In unit of point It should be between 0 and 409.5.public double getRowHeight(int row,
boolean isOriginal,
int unitType)
row - The row index.isOriginal - Whether returns the original row height or 0 for hidden row.unitType - CellsUnitType. Unit type of the returned height valuepublic double getRowOriginalHeightPoint(int row)
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.row - The row index.public double getColumnWidth(int column,
boolean isOriginal,
int unitType)
column - The column index.isOriginal - Indicates whether getting original width.unitType - CellsUnitType.public double getColumnOriginalWidthPoint(int column)
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.column - The row index.public void hideColumn(int column)
column - Column index.public void unhideColumn(int column,
double width)
column - Column index.width - Column width.public void hideColumns(int column,
int totalColumns)
column - Column index.totalColumns - Column number.public void unhideColumns(int column,
int totalColumns,
double width)
Remarks
Only applies the column width to the hidden columns.column - Column index.totalColumns - Column numberwidth - Column width.public double getRowHeight(int row)
row - Row indexpublic double getViewRowHeight(int row)
row - Row index.public double getRowHeightInch(int row)
row - Row indexpublic double getViewRowHeightInch(int row)
row - Row indexpublic int getRowHeightPixel(int row)
row - Row indexpublic void setColumnWidthPixel(int column,
int pixels)
column - Column index.pixels - Number of pixels.public void setColumnWidthInch(int column,
double inches)
column - Column index.inches - Number of inches.public void setColumnWidth(int column,
double width)
Remarks
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.column - Column index.width - Width of column in unit of characters.Column width must be between 0 and 255.public int getColumnWidthPixel(int column)
column - Column indexpublic int getColumnWidthPixel(int column,
boolean original)
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.column - Column indexoriginal - Indicates whether returning original width even when the column is hiddenpublic double getColumnWidthInch(int column)
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.column - Column indexpublic double getColumnWidth(int column)
column - Column indexpublic int getViewColumnWidthPixel(int column)
column - The column index.public void setViewColumnWidthPixel(int column,
int pixels)
Remarks
If the current view type isViewType.PAGE_LAYOUT_VIEW, the column's width is same as printed width.column - The column index.pixels - The width in unit of pixels.public int getMinRow()
Remarks
This property needs to iterate and check cells and rows dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getMaxRow()
Remarks
Return -1 if there is no cell which contains data or style in the worksheet. This property needs to iterate and check cells and rows dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getMinColumn()
Remarks
This property needs to iterate and check cells and rows dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getMaxColumn()
Remarks
Return -1 if there is no cell has been instantiated.public int getMinDataRow()
Remarks
Return -1 if there is no cell which contains data. This property needs to iterate and check cells and rows dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getMaxDataRow()
Remarks
Return -1 if there is no cell which contains data. This property needs to iterate and check cells and rows dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getMinDataColumn()
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 dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getMaxDataColumn()
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 dynamically, so it is a time-consumed progress and should not be invoked repeatedly, such as using it directly as condition in a loop.public int getLastDataRow(int column)
column - Column index.public int getFirstDataRow(int column)
column - Column index.public boolean isDefaultRowHeightMatched()
public void setDefaultRowHeightMatched(boolean value)
public boolean isDefaultRowHidden()
public void setDefaultRowHidden(boolean value)
public ColumnCollection getColumns()
Column objects that represents the individual columns in this worksheet.public void applyColumnStyle(int column,
Style style,
StyleFlag flag)
column - The column index.style - The style object which will be applied.flag - Flags which indicates applied formatting properties.public void applyRowStyle(int row,
Style style,
StyleFlag flag)
row - The row index.style - The style object which will be applied.flag - Flags which indicates applied formatting properties.public void applyStyle(Style style, StyleFlag flag)
style - The style object which will be applied.flag - Flags which indicates applied formatting properties.public void copyColumns(Cells sourceCells0, int sourceColumnIndex, int destinationColumnIndex, int columnNumber, PasteOptions pasteOptions)
sourceCells0 - Source Cells object contains data and formats to copy.sourceColumnIndex - Source column index.destinationColumnIndex - Destination column index.columnNumber - The copied column number.pasteOptions - the options of pasting.public void copyColumn(Cells sourceCells, int sourceColumnIndex, int destinationColumnIndex)
sourceCells - Source Cells object contains data and formats to copy.sourceColumnIndex - Source column index.destinationColumnIndex - Destination column index.public void copyColumns(Cells sourceCells0, int sourceColumnIndex, int destinationColumnIndex, int columnNumber)
sourceCells0 - Source Cells object contains data and formats to copy.sourceColumnIndex - Source column index.destinationColumnIndex - Destination column index.columnNumber - The copied column number.public void copyColumns(Cells sourceCells, int sourceColumnIndex, int sourceTotalColumns, int destinationColumnIndex, int destinationTotalColumns)
sourceCells - Source Cells object contains data and formats to copy.sourceColumnIndex - Source column index.sourceTotalColumns - The number of the source columns.destinationColumnIndex - Destination column index.destinationTotalColumns - The number of the destination columns.public void copyRow(Cells sourceCells, int sourceRowIndex, int destinationRowIndex)
sourceCells - Source Cells object contains data and formats to copy.sourceRowIndex - Source row index.destinationRowIndex - Destination row index.public void copyRows(Cells sourceCells, int sourceRowIndex, int destinationRowIndex, int rowNumber)
sourceCells - Source Cells object contains data and formats to copy.sourceRowIndex - Source row index.destinationRowIndex - Destination row index.rowNumber - The copied row number.public void copyRows(Cells sourceCells0, int sourceRowIndex, int destinationRowIndex, int rowNumber, CopyOptions copyOptions)
sourceCells0 - Source Cells object contains data and formats to copy.sourceRowIndex - Source row index.destinationRowIndex - Destination row index.rowNumber - The copied row number.copyOptions - The copy options.public void copyRows(Cells sourceCells0, int sourceRowIndex, int destinationRowIndex, int rowNumber, CopyOptions copyOptions, PasteOptions pasteOptions)
sourceCells0 - Source Cells object contains data and formats to copy.sourceRowIndex - Source row index.destinationRowIndex - Destination row index.rowNumber - The copied row number.copyOptions - The copy options.pasteOptions - the options of pasting.public int getGroupedRowOutlineLevel(int rowIndex)
Remarks
If the row is not grouped, returns zero.rowIndex - The row index.public int getGroupedColumnOutlineLevel(int columnIndex)
Remarks
If the column is not grouped, returns zero.columnIndex - The column indexpublic int getMaxGroupedColumnOutlineLevel()
public int getMaxGroupedRowOutlineLevel()
public void showGroupDetail(boolean isVertical,
int index)
isVertical - True, expands the grouped rows.index - The row/column indexpublic void hideGroupDetail(boolean isVertical,
int index)
isVertical - True, collapse the grouped rows.index - The row/column indexpublic void ungroupColumns(int firstIndex,
int lastIndex)
firstIndex - The first column index to be ungrouped.lastIndex - The last column index to be ungrouped.public void groupColumns(int firstIndex,
int lastIndex)
firstIndex - The first column index to be grouped.lastIndex - The last column index to be grouped.public void groupColumns(int firstIndex,
int lastIndex,
boolean isHidden)
firstIndex - The first column index to be grouped.lastIndex - The last column index to be grouped.isHidden - Specifies if the grouped columns are hidden.public void ungroupRows(int firstIndex,
int lastIndex,
boolean isAll)
firstIndex - The first row index to be ungrouped.lastIndex - The last row index to be ungrouped.isAll - True, removes all grouped info.Otherwise, remove the outer group info.public void ungroupRows(int firstIndex,
int lastIndex)
Remarks
Only removes outer group info.firstIndex - The first row index to be ungrouped.lastIndex - The last row index to be ungrouped.public void groupRows(int firstIndex,
int lastIndex,
boolean isHidden)
firstIndex - The first row index to be grouped.lastIndex - The last row index to be grouped.isHidden - Specifies if the grouped rows are hidden.public void groupRows(int firstIndex,
int lastIndex)
firstIndex - The first row index to be grouped.lastIndex - The last row index to be grouped.public void deleteColumn(int columnIndex,
boolean updateReference)
columnIndex - Index of the column to be deleted.updateReference - Indicates whether update references in other worksheets.public void deleteColumn(int columnIndex)
columnIndex - Index of the column to be deleted.public void deleteColumns(int columnIndex,
int totalColumns,
boolean updateReference)
columnIndex - Index of the first column to be deleted.totalColumns - Count of columns to be deleted.updateReference - Indicates whether update references in other worksheets.public void deleteColumns(int columnIndex,
int totalColumns,
DeleteOptions options)
columnIndex - Index of the first column to be deleted.totalColumns - Count of columns to be deleted.options - Options for the deleting operationpublic boolean isDeletingRangeEnabled(int startRow,
int startColumn,
int totalRows,
int totalColumns)
startRow - The start row index of the range.startColumn - The start column index of the range.totalRows - The number of the rows in the range.totalColumns - The number of the columns in the range.public void deleteRow(int rowIndex)
rowIndex - Index of the row to be deleted.public void deleteRow(int rowIndex,
boolean updateReference)
rowIndex - Index of the row to be deleted.updateReference - Indicates whether update references in other worksheets.public boolean deleteRows(int rowIndex,
int totalRows)
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.rowIndex - The first row index to be deleted.totalRows - Count of rows to be deleted.public boolean deleteRows(int rowIndex,
int totalRows,
boolean updateReference)
rowIndex - Index of the first row to be deleted.totalRows - Count of rows to be deleted.updateReference - Indicates whether update references in other worksheets.public boolean deleteRows(int rowIndex,
int totalRows,
DeleteOptions options)
rowIndex - Index of the first row to be deleted.totalRows - Count of rows to be deleted.options - Options for the deleting operationpublic void deleteBlankColumns()
public void deleteBlankColumns(DeleteOptions options)
options - The options of deleting range.public boolean isBlankColumn(int columnIndex)
columnIndex - the column indexpublic void deleteBlankRows()
public void deleteBlankRows(DeleteOptions options)
Remarks
For blank rows that will be deleted, it is not only required thatRow.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.options - The options of deleting range.public void insertColumns(int columnIndex,
int totalColumns)
columnIndex - Column index.totalColumns - The number of columns.public void insertColumns(int columnIndex,
int totalColumns,
boolean updateReference)
columnIndex - Column index.totalColumns - The number of columns.updateReference - Indicates if references in other worksheets will be updated.public void insertColumns(int columnIndex,
int totalColumns,
InsertOptions options)
columnIndex - Column index.totalColumns - The number of columns.options - The options for inserting operation.public void insertColumn(int columnIndex,
boolean updateReference)
columnIndex - Column index.updateReference - Indicates if references in other worksheets will be updated.public void insertColumn(int columnIndex)
columnIndex - Column index.public void insertRows(int rowIndex,
int totalRows,
boolean updateReference)
rowIndex - Row index.totalRows - Number of rows to be inserted.updateReference - Indicates if references in other worksheets will be updated.public void insertRows(int rowIndex,
int totalRows,
InsertOptions options)
rowIndex - Row index.totalRows - Number of rows to be inserted.options - Options for inserting operation.public void insertRows(int rowIndex,
int totalRows)
rowIndex - Row index.totalRows - Number of rows to be inserted.public void insertRow(int rowIndex)
rowIndex - Row index.public RangeCollection getRanges()
Range objects created at run time.public void clearRange(CellArea range)
range - Range to be cleared.public void clearRange(int startRow,
int startColumn,
int endRow,
int endColumn)
startRow - Start row index.startColumn - Start column index.endRow - End row index.endColumn - End column index.public void clearContents(CellArea range)
range - Range to be cleared.public void clearContents(int startRow,
int startColumn,
int endRow,
int endColumn)
startRow - Start row index.startColumn - Start column index.endRow - End row index.endColumn - End column index.public void clearFormats(CellArea range)
range - Range to be cleared.public void clearFormats(int startRow,
int startColumn,
int endRow,
int endColumn)
startRow - Start row index.startColumn - Start column index.endRow - End row index.endColumn - End column index.public Cell getLastCell()
Remarks
Returns null if there is no data in the worksheet.public void linkToXmlMap(java.lang.String mapName,
int row,
int column,
java.lang.String path)
mapName - name of xml maprow - row of the destination cellcolumn - column of the destination cellpath - path of xml element in xml mappublic Range getMaxDisplayRange()
Remarks
Reutrns null if the worksheet is empty since Aspose.Cells 21.5.2.public Cell getFirstCell()
Remarks
Returns null if there is no data in the worksheet.public Cell find(java.lang.Object what, Cell previousCell)
Remarks
Returns null (Nothing) if no cell is found.what - The object to search for.
The type should be int,double,DateTime,string,bool.previousCell - Previous cell with the same object.
This parameter can be set to null if searching from the start.public Cell find(java.lang.Object what, Cell previousCell, FindOptions findOptions)
Remarks
Returns null (Nothing) if no cell is found.what - The object to search for.
The type should be int,double,DateTime,string,bool.previousCell - Previous cell with the same object.
This parameter can be set to null if searching from the start.findOptions - Find optionspublic Cell endCellInRow(int rowIndex)
rowIndex - Row index.public Cell endCellInColumn(int columnIndex)
columnIndex - Column index.public Cell endCellInColumn(int startRow, int endRow, int startColumn, int endColumn)
startRow - Start row index.endRow - End row index.startColumn - Start column index.endColumn - End column index.public Cell endCellInRow(int startRow, int endRow, int startColumn, int endColumn)
startRow - Start row index.endRow - End row index.startColumn - Start column index.endColumn - End column index.public void moveRange(CellArea sourceArea, int destRow, int destColumn)
sourceArea - The range which should be moved.destRow - The dest row.destColumn - The dest column.public void insertCutCells(Range cutRange, int row, int column, int shiftType)
cutRange - The cut range.row - The row.column - The column.shiftType - ShiftType. The shift type .public void insertRange(CellArea area, int shiftNumber, int shiftType, boolean updateReference)
area - Shift area.shiftNumber - Number of rows or columns to be inserted.shiftType - ShiftType. Shift cells option.updateReference - Indicates whether update references in other worksheets.public void insertRange(CellArea area, int shiftType)
area - Shift area.shiftType - ShiftType. Shift cells option.public void insertRange(CellArea area, int shiftNumber, int shiftType)
area - Shift area.shiftNumber - Number of rows or columns to be inserted.shiftType - ShiftType. Shift cells option.public void deleteRange(int startRow,
int startColumn,
int endRow,
int endColumn,
int shiftType)
startRow - Start row index.startColumn - Start column index.endRow - End row index.endColumn - End column index.shiftType - ShiftType. Shift cells option.public java.lang.Object[][] exportArray(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Cells collection to a two-dimension array object.firstRow - The row number of the first cell to export out.firstColumn - The column number of the first cell to export out.totalRows - Number of rows to be exportedtotalColumns - Number of columns to be exportedpublic int[][] exportTypeArray(int firstRow,
int firstColumn,
int totalRows,
int totalColumns)
Cells collection to a two-dimension array object.firstRow - The row number of the first cell to export out.firstColumn - The column number of the first cell to export out.totalRows - Number of rows to be exported.totalColumns - Number of columns to be exported.CellValueType. Exported array object representing cell value types.public int importCustomObjects(java.util.Collection list,
java.lang.String[] propertyNames,
boolean isPropertyNameShown,
int firstRow,
int firstColumn,
int rowNumber,
boolean insertRows,
java.lang.String dateFormatString,
boolean convertStringToNumber)
Remarks
The custom objects should be the same type.list - The custom objectpropertyNames - The property names.If it is null,we will import all properties of the object.isPropertyNameShown - Indicates whether the property name will be imported to the first row.firstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.rowNumber - Number of rows to be imported.insertRows - Indicates whether extra rows are added to fit data.dateFormatString - Date format string for cells.convertStringToNumber - Indicates if this method will try to convert string to number.public int importCustomObjects(java.util.Collection list,
int firstRow,
int firstColumn,
ImportTableOptions options)
Remarks
The custom objects should be the same type.list - The custom objectfirstRow - The row number of the first cell to import in.firstColumn - The column number of the first cell to import in.options - The import options.public SubtotalSetting retrieveSubtotalSetting(CellArea ca)
ca - The rangepublic void subtotal(CellArea ca, int groupBy, int function, int[] totalList)
ca - The rangegroupBy - The field to group by, as a zero-based integer offsetfunction - ConsolidationFunction. The subtotal function.totalList - An array of zero-based field offsets, indicating the fields to which the subtotals are added.public void subtotal(CellArea ca, int groupBy, int function, int[] totalList, boolean replace, boolean pageBreaks, boolean summaryBelowData)
ca - The rangegroupBy - The field to group by, as a zero-based integer offsetfunction - ConsolidationFunction. The subtotal function.totalList - An array of zero-based field offsets, indicating the fields to which the subtotals are added.replace - Indicates whether replace the current subtotalspageBreaks - Indicates whether add page break between groupssummaryBelowData - Indicates whether add summary below data.public void removeFormulas()
public void removeDuplicates()
public void removeDuplicates(int startRow,
int startColumn,
int endRow,
int endColumn)
startRow - The start row.startColumn - The start columnendRow - The end row index.endColumn - The end column index.public void removeDuplicates(int startRow,
int startColumn,
int endRow,
int endColumn,
boolean hasHeaders,
int[] columnOffsets)
startRow - The start row.startColumn - The start columnendRow - The end row index.endColumn - The end column index.hasHeaders - Indicates whether the range contains headers.columnOffsets - The column offsets.public void convertStringToNumericValue()
public Cell[] getDependents(boolean isAll, int row, int column)
isAll - Indicates whether check other worksheetsrow - The row index.column - The column index.public java.util.Iterator getDependentsInCalculation(int row,
int column,
boolean recursive)
Remarks
To use this method, please make sure the workbook has been set with true value forFormulaSettings.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)row - Row index of the specific cellcolumn - Column index of the specific cell.recursive - Whether returns those dependents which do not reference to the specific cell directly
but reference to other leafs of that cell.public java.util.Iterator getCellsWithPlaceInCellPicture()
Remarks
If there is no picture which is set as "Place in Cell" in this worksheet, null will be returned.public Style getCellStyle(int row, int column)
Remarks
The returned style is only the one set for the cell or inherited from the row/column of the cell, does not include the applied properties by other settings such as conditional formattings.row - row indexcolumn - columnpublic Style getCellDisplayStyle(int row, int column)
Remarks
Same withCell.getDisplayStyle(),
and same with using BorderType.SIDE_BORDERS
for getCellDisplayStyle(int,int,int).row - row index of given cellcolumn - column of given cellpublic Style getCellDisplayStyle(int row, int column, int adjacentBorders)
Remarks
If the cell is also affected by other settings such as conditional formatting, list objects, etc., then the display style may be different fromgetCellStyle(int,int).
And because those settings also may be applied to empty(non-existing) cells,
using this method can avoid the instantiation of those empty cells
so the performance will be better than getting the Cell instance from Cells
and then calling Cell.getDisplayStyle(int).row - row index of given cellcolumn - column of given celladjacentBorders - BorderType.
Indicates which borders need to be checked and adjusted according to the borders of adjacent cells.
Please see the description for the same parameter of
Cell.getDisplayStyle(int).public int importResultSet(java.sql.ResultSet rs,
java.lang.String startCell,
ImportTableOptions options)
rs - the ResultSet object to import from.startCell - name of start cell to insert the resultset, such as "A1".options - The import optionspublic int importResultSet(java.sql.ResultSet rs,
int rowIndex,
int columnIndex,
ImportTableOptions options)
rs - the ResultSet object to import from.rowIndex - start row index in the worksheet.columnIndex - start column index in the worksheet.options - The import optionspublic int importResultSet(java.sql.ResultSet rs,
int rowIndex,
int columnIndex,
int rowNum,
int columnNum,
boolean isFieldNameShown)
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. -1 to import all records in given resultset.columnNum - number of columns to import. -1 to import all columns in given resultset.isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.public int importResultSet(java.sql.ResultSet rs,
java.lang.String startCell,
int rowNum,
int columnNum,
boolean isFieldNameShown)
rs - the ResultSet object to import from.startCell - name of start cell to insert the resultset, such as "A1".rowNum - number of rows to import. -1 to import all records in given resultset.columnNum - number of columns to import. -1 to import all columns in given resultset.isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.public int importResultSet(java.sql.ResultSet rs,
int rowIndex,
int columnIndex,
boolean isFieldNameShown)
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.public int importResultSet(java.sql.ResultSet rs,
java.lang.String startCell,
boolean isFieldNameShown)
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.public int importResultSet(java.sql.ResultSet rs,
int rowIndex,
int columnIndex,
int rowNum,
int columnNum,
boolean isFieldNameShown,
java.lang.String customDateFormatString,
boolean convertStringToNumber)
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. -1 to import all records in given resultset.columnNum - number of columns to import. -1 to import all columns in given resultset.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.public int importResultSet(java.sql.ResultSet rs,
int rowIndex,
int columnIndex,
boolean isFieldNameShown,
java.lang.String customDateFormatString,
boolean convertStringToNumber)
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.See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.