Cells
Cells class
Encapsulates a collection of cell relevant objects, such as Cell, Row, …etc.
class Cells;
Example
const { Workbook } = require("aspose.cells.node");
var excel = new Workbook();
var cells = excel.worksheets.get(0).cells;
//Set default row height
cells.standardHeight = 20;
//Set row height
cells.setRowHeight(2, 20.5);
//Set default colum width
cells.standardWidth = 15;
//Set column width
cells.setColumnWidth(3, 12.57);
//Merge cells
cells.merge(5, 4, 2, 2);
Properties
| Property | Type | Description |
|---|---|---|
| odsCellFields | OdsCellFieldCollection | Readonly. Gets the list of fields of ods. |
| count | number | Readonly. Gets the total count of instantiated Cell objects. |
| countLarge | number | Readonly. Gets the total count of instantiated Cell objects. |
| rows | RowCollection | Readonly. Gets the collection of Row objects that represents the individual rows in this worksheet. |
| multiThreadReading | boolean | Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false. |
| memorySetting | MemorySetting | Gets or sets the memory usage option for this cells. |
| style | Style | Gets and sets the default style of the worksheet. |
| isDefaultColumnHidden | boolean | |
| standardWidthInch | number | Gets or sets the default column width in the worksheet, in unit of inches. |
| standardWidthPixels | number | Gets or sets the default column width in the worksheet, in unit of pixels. |
| standardWidth | number | Gets or sets the default column width in the worksheet, in unit of characters. |
| standardHeight | number | Gets or sets the default row height in this worksheet, in unit of points. |
| standardHeightPixels | number | Gets or sets the default row height in this worksheet, in unit of pixels. |
| standardHeightInch | number | Gets or sets the default row height in this worksheet, in unit of inches. |
| preserveString | boolean | Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false. |
| minRow | number | Readonly. Minimum row index of cell which contains data or style. |
| maxRow | number | Readonly. Maximum row index of cell which contains data or style. |
| minColumn | number | Readonly. 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). |
| maxColumn | number | Readonly. 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). |
| minDataRow | number | Readonly. Minimum row index of cell which contains data. |
| maxDataRow | number | Readonly. Maximum row index of cell which contains data. |
| minDataColumn | number | Readonly. Minimum column index of cell which contains data. |
| maxDataColumn | number | Readonly. Maximum column index of cell which contains data. |
| isDefaultRowHeightMatched | boolean | Indicates that row height and default font height matches |
| isDefaultRowHidden | boolean | Indicates whether the row is default hidden. |
| columns | ColumnCollection | Readonly. Gets the collection of Column objects that represents the individual columns in this worksheet. |
| ranges | RangeCollection | Readonly. Gets the collection of Range objects created at run time. |
| lastCell | Cell | Readonly. Gets the last cell in this worksheet. |
| maxDisplayRange | Range | Readonly. Gets the max range which includes data, merged cells and shapes. |
| firstCell | Cell | Readonly. Gets the first cell in this worksheet. |
Methods
| Method | Description |
|---|---|
| get(number, number) | Gets the Cell element at the specified cell row index and column index. |
| get(string) | Gets the Cell element at the specified cell name. |
| getOdsCellFields() | @deprecated. Please use the ‘odsCellFields’ property instead. Gets the list of fields of ods. |
| getCount() | @deprecated. Please use the ‘count’ property instead. Gets the total count of instantiated Cell objects. |
| getCountLarge() | @deprecated. Please use the ‘countLarge’ property instead. Gets the total count of instantiated Cell objects. |
| getRows() | @deprecated. Please use the ‘rows’ property instead. Gets the collection of Row objects that represents the individual rows in this worksheet. |
| getMultiThreadReading() | @deprecated. Please use the ‘multiThreadReading’ property instead. Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false. |
| setMultiThreadReading(boolean) | @deprecated. Please use the ‘multiThreadReading’ property instead. Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false. |
| getMemorySetting() | @deprecated. Please use the ‘memorySetting’ property instead. Gets or sets the memory usage option for this cells. |
| setMemorySetting(MemorySetting) | @deprecated. Please use the ‘memorySetting’ property instead. Gets or sets the memory usage option for this cells. |
| getStyle() | @deprecated. Please use the ‘style’ property instead. Gets and sets the default style of the worksheet. |
| setStyle(Style) | @deprecated. Please use the ‘style’ property instead. Gets and sets the default style of the worksheet. |
| isDefaultColumnHidden() | @deprecated. Please use the ‘isDefaultColumnHidden’ property instead. |
| setIsDefaultColumnHidden(boolean) | @deprecated. Please use the ‘isDefaultColumnHidden’ property instead. |
| getStandardWidthInch() | @deprecated. Please use the ‘standardWidthInch’ property instead. Gets or sets the default column width in the worksheet, in unit of inches. |
| setStandardWidthInch(number) | @deprecated. Please use the ‘standardWidthInch’ property instead. Gets or sets the default column width in the worksheet, in unit of inches. |
| getStandardWidthPixels() | @deprecated. Please use the ‘standardWidthPixels’ property instead. Gets or sets the default column width in the worksheet, in unit of pixels. |
| setStandardWidthPixels(number) | @deprecated. Please use the ‘standardWidthPixels’ property instead. Gets or sets the default column width in the worksheet, in unit of pixels. |
| getStandardWidth() | @deprecated. Please use the ‘standardWidth’ property instead. Gets or sets the default column width in the worksheet, in unit of characters. |
| setStandardWidth(number) | @deprecated. Please use the ‘standardWidth’ property instead. Gets or sets the default column width in the worksheet, in unit of characters. |
| getStandardHeight() | @deprecated. Please use the ‘standardHeight’ property instead. Gets or sets the default row height in this worksheet, in unit of points. |
| setStandardHeight(number) | @deprecated. Please use the ‘standardHeight’ property instead. Gets or sets the default row height in this worksheet, in unit of points. |
| getStandardHeightPixels() | @deprecated. Please use the ‘standardHeightPixels’ property instead. Gets or sets the default row height in this worksheet, in unit of pixels. |
| setStandardHeightPixels(number) | @deprecated. Please use the ‘standardHeightPixels’ property instead. Gets or sets the default row height in this worksheet, in unit of pixels. |
| getStandardHeightInch() | @deprecated. Please use the ‘standardHeightInch’ property instead. Gets or sets the default row height in this worksheet, in unit of inches. |
| setStandardHeightInch(number) | @deprecated. Please use the ‘standardHeightInch’ property instead. Gets or sets the default row height in this worksheet, in unit of inches. |
| getPreserveString() | @deprecated. Please use the ‘preserveString’ property instead. Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false. |
| setPreserveString(boolean) | @deprecated. Please use the ‘preserveString’ property instead. Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false. |
| getMinRow() | @deprecated. Please use the ‘minRow’ property instead. Minimum row index of cell which contains data or style. |
| getMaxRow() | @deprecated. Please use the ‘maxRow’ property instead. Maximum row index of cell which contains data or style. |
| getMinColumn() | @deprecated. Please use the ‘minColumn’ property instead. 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). |
| getMaxColumn() | @deprecated. Please use the ‘maxColumn’ property instead. 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). |
| getMinDataRow() | @deprecated. Please use the ‘minDataRow’ property instead. Minimum row index of cell which contains data. |
| getMaxDataRow() | @deprecated. Please use the ‘maxDataRow’ property instead. Maximum row index of cell which contains data. |
| getMinDataColumn() | @deprecated. Please use the ‘minDataColumn’ property instead. Minimum column index of cell which contains data. |
| getMaxDataColumn() | @deprecated. Please use the ‘maxDataColumn’ property instead. Maximum column index of cell which contains data. |
| isDefaultRowHeightMatched() | @deprecated. Please use the ‘isDefaultRowHeightMatched’ property instead. Indicates that row height and default font height matches |
| setIsDefaultRowHeightMatched(boolean) | @deprecated. Please use the ‘isDefaultRowHeightMatched’ property instead. Indicates that row height and default font height matches |
| isDefaultRowHidden() | @deprecated. Please use the ‘isDefaultRowHidden’ property instead. Indicates whether the row is default hidden. |
| setIsDefaultRowHidden(boolean) | @deprecated. Please use the ‘isDefaultRowHidden’ property instead. Indicates whether the row is default hidden. |
| getColumns() | @deprecated. Please use the ‘columns’ property instead. Gets the collection of Column objects that represents the individual columns in this worksheet. |
| getRanges() | @deprecated. Please use the ‘ranges’ property instead. Gets the collection of Range objects created at run time. |
| getLastCell() | @deprecated. Please use the ’lastCell’ property instead. Gets the last cell in this worksheet. |
| getMaxDisplayRange() | @deprecated. Please use the ‘maxDisplayRange’ property instead. Gets the max range which includes data, merged cells and shapes. |
| getFirstCell() | @deprecated. Please use the ‘firstCell’ property instead. Gets the first cell in this worksheet. |
| dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| getEnumerator() | Gets the cells enumerator. |
| getMergedAreas() | Gets all merged cells. |
| getCell(number, number) | Gets the Cell element or null at the specified cell row index and column index. |
| getRow(number) | Gets the Row element at the specified cell row index. |
| checkCell(number, number) | Gets the Cell element or null at the specified cell row index and column index. |
| checkRow(number) | Gets the Row element or null at the specified cell row index. |
| checkColumn(number) | Gets the Column element or null at the specified column index. |
| isRowHidden(number) | Checks whether a row at given index is hidden. |
| isColumnHidden(number) | Checks whether a column at given index is hidden. |
| addRange(Range) | Adds a range object reference to cells |
| createRange(string, string) | Creates a Range object from a range of cells. |
| createRange(number, number, number, number) | Creates a Range object from a range of cells. |
| createRange(string) | Creates a Range object from an address of the range. |
| createRange(number, number, boolean) | Creates a Range object from rows of cells or columns of cells. |
| clear() | Clears all data of the worksheet. |
| importFormulaArray(string[], number, number, boolean) | Imports an array of formula into a worksheet. |
| textToColumns(number, number, number, TxtLoadOptions) | Splits content in specified column into multiple columns.. |
| importCSV(string, string, boolean, number, number) | Import a CSV file to the cells. |
| importCSV(Uint8Array, string, boolean, number, number) | Import a CSV file to the cells. |
| importCSV(string, TxtLoadOptions, number, number) | Import a CSV file to the cells. |
| importCSV(Uint8Array, TxtLoadOptions, number, number) | Import a CSV file to the cells. |
| importCSVAsync(string, string, boolean, number, number) | Import a CSV file to the cells. |
| importCSVAsync(Uint8Array, string, boolean, number, number) | Import a CSV file to the cells. |
| importCSVAsync(string, TxtLoadOptions, number, number) | Import a CSV file to the cells. |
| importCSVAsync(Uint8Array, TxtLoadOptions, number, number) | Import a CSV file to the cells. |
| merge(number, number, number, number) | Merges a specified range of cells into a single cell. |
| merge(number, number, number, number, boolean) | Merges a specified range of cells into a single cell. |
| merge(number, number, number, number, boolean, boolean) | Merges a specified range of cells into a single cell. |
| unMerge(number, number, number, number) | Unmerges a specified range of merged cells. |
| clearMergedCells() | Clears all merged ranges. |
| hideRow(number) | Hides a row. |
| unhideRow(number, number) | Unhides a row. |
| hideRows(number, number) | Hides multiple rows. |
| unhideRows(number, number, number) | Unhides the hidden rows. |
| setRowHeightPixel(number, number) | Sets row height in unit of pixels. |
| setRowHeightInch(number, number) | Sets row height in unit of inches. |
| setRowHeight(number, number) | Sets the height of the specified row. |
| getRowHeight(number, boolean, CellsUnitType) | Gets row’s height. |
| getRowHeight(number) | Gets the height of a specified row, in unit of points. |
| getRowOriginalHeightPoint(number) | Gets original row’s height in unit of point if the row is hidden |
| getColumnWidth(number, boolean, CellsUnitType) | Gets the column width. |
| getColumnWidth(number) | Gets the width(in unit of characters) of the specified column in normal view |
| getColumnOriginalWidthPoint(number) | Gets original column’s height in unit of point if the column is hidden |
| hideColumn(number) | Hides a column. |
| unhideColumn(number, number) | Unhides a column |
| hideColumns(number, number) | Hide multiple columns. |
| unhideColumns(number, number, number) | Unhide multiple columns. |
| getViewRowHeight(number) | Gets the height of a specified row. |
| getRowHeightInch(number) | Gets the height of a specified row in unit of inches. |
| getViewRowHeightInch(number) | Gets the height of a specified row in unit of inches. |
| getRowHeightPixel(number) | Gets the height of a specified row in unit of pixel. |
| setColumnWidthPixel(number, number) | Sets column width in unit of pixels in normal view. |
| setColumnWidthInch(number, number) | Sets column width in unit of inches in normal view. |
| setColumnWidth(number, number) | Sets the width of the specified column in normal view. |
| getColumnWidthPixel(number) | Gets the width of the specified column in normal view, in units of pixel. |
| getColumnWidthPixel(number, boolean) | Gets the width of the specified column in normal view, in units of pixel. |
| getColumnWidthInch(number) | Gets the width of the specified column in normal view, in units of inches. |
| getViewColumnWidthPixel(number) | Get the width in different view type. |
| setViewColumnWidthPixel(number, number) | Sets the width of the column in different view. |
| getLastDataRow(number) | Gets the last row index of cell which contains data in the specified column. |
| getFirstDataRow(number) | Gets the first row index of cell which contains data in the specified column. |
| applyColumnStyle(number, Style, StyleFlag) | Applies formats for a whole column. |
| applyRowStyle(number, Style, StyleFlag) | Applies formats for a whole row. |
| applyStyle(Style, StyleFlag) | Applies formats for a whole worksheet. |
| copyColumns(Cells, number, number, number, PasteOptions) | Copies data and formats of a whole column. |
| copyColumns(Cells, number, number, number) | Copies data and formats of whole columns. |
| copyColumns(Cells, number, number, number, number) | Copies data and formats of the whole columns. |
| copyColumn(Cells, number, number) | Copies data and formats of a whole column. |
| copyRow(Cells, number, number) | Copies data and formats of a whole row. |
| copyRows(Cells, number, number, number) | Copies data and formats of some whole rows. |
| copyRows(Cells, number, number, number, CopyOptions) | Copies data and formats of some whole rows. |
| copyRows(Cells, number, number, number, CopyOptions, PasteOptions) | Copies data and formats of some whole rows. |
| getGroupedRowOutlineLevel(number) | Gets the outline level (zero-based) of the row. |
| getGroupedColumnOutlineLevel(number) | Gets the outline level (zero-based) of the column. |
| getMaxGroupedColumnOutlineLevel() | Gets the max grouped column outline level (zero-based). |
| getMaxGroupedRowOutlineLevel() | Gets the max grouped row outline level (zero-based). |
| showGroupDetail(boolean, number) | Expands the grouped rows/columns. |
| hideGroupDetail(boolean, number) | Collapses the grouped rows/columns. |
| ungroupColumns(number, number) | Ungroups columns. |
| groupColumns(number, number) | Groups columns. |
| groupColumns(number, number, boolean) | Groups columns. |
| ungroupRows(number, number, boolean) | Ungroups rows. |
| ungroupRows(number, number) | Ungroups rows. |
| groupRows(number, number, boolean) | Groups rows. |
| groupRows(number, number) | Groups rows. |
| deleteColumn(number, boolean) | Deletes a column. |
| deleteColumn(number) | Deletes a column. |
| deleteColumns(number, number, boolean) | Deletes several columns. |
| deleteColumns(number, number, DeleteOptions) | Deletes several columns. |
| isDeletingRangeEnabled(number, number, number, number) | Check whether the range could be deleted. |
| deleteRow(number) | Deletes a row. |
| deleteRow(number, boolean) | Deletes a row. |
| deleteRows(number, number) | Deletes multiple rows. |
| deleteRows(number, number, boolean) | Deletes multiple rows in the worksheet. |
| deleteRows(number, number, DeleteOptions) | Deletes multiple rows in the worksheet. |
| deleteBlankColumns() | Delete all blank columns which do not contain any data. |
| deleteBlankColumns(DeleteOptions) | Delete all blank columns which do not contain any data. |
| isBlankColumn(number) | Checks whether given column is blank(does not contain any data). |
| deleteBlankRows() | Delete all blank rows which do not contain any data or other object. |
| deleteBlankRows(DeleteOptions) | Delete all blank rows which do not contain any data or some special objects such as visible comment, pivot table. |
| insertColumns(number, number) | Inserts some columns into the worksheet. |
| insertColumns(number, number, boolean) | Inserts some columns into the worksheet. |
| insertColumns(number, number, InsertOptions) | Inserts some columns into the worksheet. |
| insertColumn(number, boolean) | Inserts a new column into the worksheet. |
| insertColumn(number) | Inserts a new column into the worksheet. |
| insertRows(number, number, boolean) | Inserts multiple rows into the worksheet. |
| insertRows(number, number, InsertOptions) | Inserts multiple rows into the worksheet. |
| insertRows(number, number) | Inserts multiple rows into the worksheet. |
| insertRow(number) | Inserts a new row into the worksheet. |
| clearRange(CellArea) | Clears contents and formatting of a range. |
| clearRange(number, number, number, number) | Clears contents and formatting of a range. |
| clearContents(CellArea) | Clears contents of a range. |
| clearContents(number, number, number, number) | Clears contents of a range. |
| clearFormats(CellArea) | Clears formatting of a range. |
| clearFormats(number, number, number, number) | Clears formatting of a range. |
| linkToXmlMap(string, number, number, string) | Link to a xml map. |
| find(Object, Cell) | Finds the cell containing with the input object. |
| find(Object, Cell, FindOptions) | Finds the cell containing with the input object. |
| endCellInRow(number) | Gets the last cell in this row. |
| endCellInRow(number, number, number, number) | Gets the last cell with maximum row index in this range. |
| endCellInColumn(number) | Gets the last cell in this column. |
| endCellInColumn(number, number, number, number) | Gets the last cell with maximum column index in this range. |
| moveRange(CellArea, number, number) | Moves the range. |
| insertCutCells(Range, number, number, ShiftType) | Insert cut range. |
| insertRange(CellArea, number, ShiftType, boolean) | Inserts a range of cells and shift cells according to the shift option. |
| insertRange(CellArea, ShiftType) | Inserts a range of cells and shift cells according to the shift option. |
| insertRange(CellArea, number, ShiftType) | Inserts a range of cells and shift cells according to the shift option. |
| deleteRange(number, number, number, number, ShiftType) | Deletes a range of cells and shift cells according to the shift option. |
| exportArray(number, number, number, number) | Exports data in the Cells collection to a two-dimension array object. |
| retrieveSubtotalSetting(CellArea) | Retrieves subtotals setting of the range. |
| subtotal(CellArea, number, ConsolidationFunction, number[]) | Creates subtotals for the range. |
| subtotal(CellArea, number, ConsolidationFunction, number[], boolean, boolean, boolean) | Creates subtotals for the range. |
| removeFormulas() | Removes all formula and replaces with the value of the formula. |
| removeDuplicates() | Removes duplicate rows in the sheet. |
| removeDuplicates(number, number, number, number) | Removes duplicate values in the range. |
| removeDuplicates(number, number, number, number, boolean, number[]) | Removes duplicate data of the range. |
| convertStringToNumericValue() | Converts all string data in the worksheet to numeric value if possible. |
| getDependents(boolean, number, number) | Get all cells which refer to the specific cell. |
| getDependentsInCalculation(number, number, boolean) | Gets all cells whose calculated result depends on specific cell. |
| getCellsWithPlaceInCellPicture() | Gets all cells that contain embedded picture. |
| getCellStyle(number, number) | Get the style of given cell. |
| getCellDisplayStyle(number, number) | Get the display style of given cell. |
| getCellDisplayStyle(number, number, BorderType) | Get the display style of given cell. |
| isNull() | Checks whether the implementation object is null. |
odsCellFields
Readonly. Gets the list of fields of ods.
odsCellFields : OdsCellFieldCollection;
count
Readonly. Gets the total count of instantiated Cell objects.
count : number;
countLarge
Readonly. Gets the total count of instantiated Cell objects.
countLarge : number;
rows
Readonly. Gets the collection of Row objects that represents the individual rows in this worksheet.
rows : RowCollection;
multiThreadReading
Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false.
multiThreadReading : boolean;
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.StringValue, Cell.DisplayStringValue, .etc.). So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.
memorySetting
Gets or sets the memory usage option for this cells.
memorySetting : MemorySetting;
Remarks
Notable limits and recommended operations for some modes:
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.
style
Gets and sets the default style of the worksheet.
style : Style;
isDefaultColumnHidden
isDefaultColumnHidden : boolean;
standardWidthInch
Gets or sets the default column width in the worksheet, in unit of inches.
standardWidthInch : number;
standardWidthPixels
Gets or sets the default column width in the worksheet, in unit of pixels.
standardWidthPixels : number;
standardWidth
Gets or sets the default column width in the worksheet, in unit of characters.
standardWidth : number;
standardHeight
Gets or sets the default row height in this worksheet, in unit of points.
standardHeight : number;
standardHeightPixels
Gets or sets the default row height in this worksheet, in unit of pixels.
standardHeightPixels : number;
standardHeightInch
Gets or sets the default row height in this worksheet, in unit of inches.
standardHeightInch : number;
preserveString
Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false.
preserveString : boolean;
minRow
Readonly. Minimum row index of cell which contains data or style.
minRow : number;
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.
maxRow
Readonly. Maximum row index of cell which contains data or style.
maxRow : number;
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.
minColumn
Readonly. 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).
minColumn : number;
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.
maxColumn
Readonly. 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).
maxColumn : number;
Remarks
Return -1 if there is no cell has been instantiated.
minDataRow
Readonly. Minimum row index of cell which contains data.
minDataRow : number;
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.
maxDataRow
Readonly. Maximum row index of cell which contains data.
maxDataRow : number;
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.
minDataColumn
Readonly. Minimum column index of cell which contains data.
minDataColumn : number;
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.
maxDataColumn
Readonly. Maximum column index of cell which contains data.
maxDataColumn : number;
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.
isDefaultRowHeightMatched
Indicates that row height and default font height matches
isDefaultRowHeightMatched : boolean;
isDefaultRowHidden
Indicates whether the row is default hidden.
isDefaultRowHidden : boolean;
columns
Readonly. Gets the collection of Column objects that represents the individual columns in this worksheet.
columns : ColumnCollection;
ranges
Readonly. Gets the collection of Range objects created at run time.
ranges : RangeCollection;
lastCell
Readonly. Gets the last cell in this worksheet.
lastCell : Cell;
Remarks
Returns null if there is no data in the worksheet.
maxDisplayRange
Readonly. Gets the max range which includes data, merged cells and shapes.
maxDisplayRange : Range;
Remarks
Reutrns null if the worksheet is empty since Aspose.Cells 21.5.2.
firstCell
Readonly. Gets the first cell in this worksheet.
firstCell : Cell;
Remarks
Returns null if there is no data in the worksheet.
get(number, number)
Gets the Cell element at the specified cell row index and column index.
get(row: number, column: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
| column | number | Column index. |
Returns
The Cell object.
Example
const { Workbook } = require("aspose.cells.node");
var excel = new Workbook();
var cells = excel.worksheets.get(0).cells;
var cell = cells.get(0, 0); //Gets the cell at "A1"
get(string)
Gets the Cell element at the specified cell name.
get(cellName: string) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| cellName | string | Cell name,including its column letter and row number, for example A5. |
Returns
A Cell object
Example
const { Workbook } = require("aspose.cells.node");
var excel = new Workbook();
var cells = excel.worksheets.get(0).cells;
var cell = cells.get("A1"); //Gets the cell at "A1"
getOdsCellFields()
@deprecated. Please use the ‘odsCellFields’ property instead. Gets the list of fields of ods.
getOdsCellFields() : OdsCellFieldCollection;
Returns
getCount()
@deprecated. Please use the ‘count’ property instead. Gets the total count of instantiated Cell objects.
getCount() : number;
getCountLarge()
@deprecated. Please use the ‘countLarge’ property instead. Gets the total count of instantiated Cell objects.
getCountLarge() : number;
getRows()
@deprecated. Please use the ‘rows’ property instead. Gets the collection of Row objects that represents the individual rows in this worksheet.
getRows() : RowCollection;
Returns
getMultiThreadReading()
@deprecated. Please use the ‘multiThreadReading’ property instead. Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false.
getMultiThreadReading() : boolean;
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.StringValue, Cell.DisplayStringValue, .etc.). So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.
setMultiThreadReading(boolean)
@deprecated. Please use the ‘multiThreadReading’ property instead. Gets or sets whether the cells data model should support Multi-Thread reading. Default value of this property is false.
setMultiThreadReading(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
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.StringValue, Cell.DisplayStringValue, .etc.). So, even with this property being set as true, those APIs still may give unexpected result for Multi-Thread reading.
getMemorySetting()
@deprecated. Please use the ‘memorySetting’ property instead. Gets or sets the memory usage option for this cells.
getMemorySetting() : MemorySetting;
Returns
Remarks
Notable limits and recommended operations for some modes:
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.
setMemorySetting(MemorySetting)
@deprecated. Please use the ‘memorySetting’ property instead. Gets or sets the memory usage option for this cells.
setMemorySetting(value: MemorySetting) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | MemorySetting | The value to set. |
Remarks
Notable limits and recommended operations for some modes:
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.
getStyle()
@deprecated. Please use the ‘style’ property instead. Gets and sets the default style of the worksheet.
getStyle() : Style;
Returns
setStyle(Style)
@deprecated. Please use the ‘style’ property instead. Gets and sets the default style of the worksheet.
setStyle(value: Style) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | Style | The value to set. |
isDefaultColumnHidden()
@deprecated. Please use the ‘isDefaultColumnHidden’ property instead.
isDefaultColumnHidden() : boolean;
setIsDefaultColumnHidden(boolean)
@deprecated. Please use the ‘isDefaultColumnHidden’ property instead.
setIsDefaultColumnHidden(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getStandardWidthInch()
@deprecated. Please use the ‘standardWidthInch’ property instead. Gets or sets the default column width in the worksheet, in unit of inches.
getStandardWidthInch() : number;
setStandardWidthInch(number)
@deprecated. Please use the ‘standardWidthInch’ property instead. Gets or sets the default column width in the worksheet, in unit of inches.
setStandardWidthInch(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
getStandardWidthPixels()
@deprecated. Please use the ‘standardWidthPixels’ property instead. Gets or sets the default column width in the worksheet, in unit of pixels.
getStandardWidthPixels() : number;
setStandardWidthPixels(number)
@deprecated. Please use the ‘standardWidthPixels’ property instead. Gets or sets the default column width in the worksheet, in unit of pixels.
setStandardWidthPixels(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
getStandardWidth()
@deprecated. Please use the ‘standardWidth’ property instead. Gets or sets the default column width in the worksheet, in unit of characters.
getStandardWidth() : number;
setStandardWidth(number)
@deprecated. Please use the ‘standardWidth’ property instead. Gets or sets the default column width in the worksheet, in unit of characters.
setStandardWidth(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
getStandardHeight()
@deprecated. Please use the ‘standardHeight’ property instead. Gets or sets the default row height in this worksheet, in unit of points.
getStandardHeight() : number;
setStandardHeight(number)
@deprecated. Please use the ‘standardHeight’ property instead. Gets or sets the default row height in this worksheet, in unit of points.
setStandardHeight(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
getStandardHeightPixels()
@deprecated. Please use the ‘standardHeightPixels’ property instead. Gets or sets the default row height in this worksheet, in unit of pixels.
getStandardHeightPixels() : number;
setStandardHeightPixels(number)
@deprecated. Please use the ‘standardHeightPixels’ property instead. Gets or sets the default row height in this worksheet, in unit of pixels.
setStandardHeightPixels(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
getStandardHeightInch()
@deprecated. Please use the ‘standardHeightInch’ property instead. Gets or sets the default row height in this worksheet, in unit of inches.
getStandardHeightInch() : number;
setStandardHeightInch(number)
@deprecated. Please use the ‘standardHeightInch’ property instead. Gets or sets the default row height in this worksheet, in unit of inches.
setStandardHeightInch(value: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | number | The value to set. |
getPreserveString()
@deprecated. Please use the ‘preserveString’ property instead. Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false.
getPreserveString() : boolean;
setPreserveString(boolean)
@deprecated. Please use the ‘preserveString’ property instead. Gets or sets a value indicating whether all worksheet values are preserved as strings. Default is false.
setPreserveString(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getMinRow()
@deprecated. Please use the ‘minRow’ property instead. Minimum row index of cell which contains data or style.
getMinRow() : number;
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.
getMaxRow()
@deprecated. Please use the ‘maxRow’ property instead. Maximum row index of cell which contains data or style.
getMaxRow() : number;
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.
getMinColumn()
@deprecated. Please use the ‘minColumn’ property instead. 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).
getMinColumn() : number;
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.
getMaxColumn()
@deprecated. Please use the ‘maxColumn’ property instead. 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).
getMaxColumn() : number;
Remarks
Return -1 if there is no cell has been instantiated.
getMinDataRow()
@deprecated. Please use the ‘minDataRow’ property instead. Minimum row index of cell which contains data.
getMinDataRow() : number;
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.
getMaxDataRow()
@deprecated. Please use the ‘maxDataRow’ property instead. Maximum row index of cell which contains data.
getMaxDataRow() : number;
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.
getMinDataColumn()
@deprecated. Please use the ‘minDataColumn’ property instead. Minimum column index of cell which contains data.
getMinDataColumn() : number;
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.
getMaxDataColumn()
@deprecated. Please use the ‘maxDataColumn’ property instead. Maximum column index of cell which contains data.
getMaxDataColumn() : number;
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.
isDefaultRowHeightMatched()
@deprecated. Please use the ‘isDefaultRowHeightMatched’ property instead. Indicates that row height and default font height matches
isDefaultRowHeightMatched() : boolean;
setIsDefaultRowHeightMatched(boolean)
@deprecated. Please use the ‘isDefaultRowHeightMatched’ property instead. Indicates that row height and default font height matches
setIsDefaultRowHeightMatched(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
isDefaultRowHidden()
@deprecated. Please use the ‘isDefaultRowHidden’ property instead. Indicates whether the row is default hidden.
isDefaultRowHidden() : boolean;
setIsDefaultRowHidden(boolean)
@deprecated. Please use the ‘isDefaultRowHidden’ property instead. Indicates whether the row is default hidden.
setIsDefaultRowHidden(value: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean | The value to set. |
getColumns()
@deprecated. Please use the ‘columns’ property instead. Gets the collection of Column objects that represents the individual columns in this worksheet.
getColumns() : ColumnCollection;
Returns
getRanges()
@deprecated. Please use the ‘ranges’ property instead. Gets the collection of Range objects created at run time.
getRanges() : RangeCollection;
Returns
getLastCell()
@deprecated. Please use the ’lastCell’ property instead. Gets the last cell in this worksheet.
getLastCell() : Cell;
Returns
Remarks
Returns null if there is no data in the worksheet.
getMaxDisplayRange()
@deprecated. Please use the ‘maxDisplayRange’ property instead. Gets the max range which includes data, merged cells and shapes.
getMaxDisplayRange() : Range;
Returns
Remarks
Reutrns null if the worksheet is empty since Aspose.Cells 21.5.2.
getFirstCell()
@deprecated. Please use the ‘firstCell’ property instead. Gets the first cell in this worksheet.
getFirstCell() : Cell;
Returns
Remarks
Returns null if there is no data in the worksheet.
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
dispose() : void;
getEnumerator()
Gets the cells enumerator.
getEnumerator() : CellEnumerator;
Returns
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).
getMergedAreas()
Gets all merged cells.
getMergedAreas() : CellArea[];
Returns
CellArea[]
getCell(number, number)
Gets the Cell element or null at the specified cell row index and column index.
getCell(row: number, column: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
| column | number | Column index |
Returns
Return Cell object if a Cell object exists. Return null if the cell does not exist.
Remarks
NOTE: This member is now obsolete. Instead, please use CheckCell(int row, int column) method. This method will be removed 12 months later since February 2024. Aspose apologizes for any inconvenience you may have experienced.
getRow(number)
Gets the Row element at the specified cell row index.
getRow(row: number) : Row;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
Returns
If the row object does exist return Row object, otherwise return null.
Remarks
NOTE: This member is now obsolete. Instead, please use Cells.CheckRow(int row) method. This method will be removed 12 months later since February 2024. Aspose apologizes for any inconvenience you may have experienced.
checkCell(number, number)
Gets the Cell element or null at the specified cell row index and column index.
checkCell(row: number, column: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
| column | number | Column index |
Returns
Return Cell object if a Cell object exists. Return null if the cell does not exist.
checkRow(number)
Gets the Row element or null at the specified cell row index.
checkRow(row: number) : Row;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
Returns
Returns Row object If the row object does exist, otherwise returns null.
checkColumn(number)
Gets the Column element or null at the specified column index.
checkColumn(columnIndex: number) : Column;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | The column index. |
Returns
The Column object.
isRowHidden(number)
Checks whether a row at given index is hidden.
isRowHidden(rowIndex: number) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | row index |
Returns
true if the row is hidden
isColumnHidden(number)
Checks whether a column at given index is hidden.
isColumnHidden(columnIndex: number) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | column index |
Returns
true if the column is hidden.
addRange(Range)
Adds a range object reference to cells
addRange(rangeObject: Range) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rangeObject | Range | The range object will be contained in the cells |
createRange(string, string)
Creates a Range object from a range of cells.
createRange(upperLeftCell: string, lowerRightCell: string) : Range;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| upperLeftCell | string | Upper left cell name. |
| lowerRightCell | string | Lower right cell name. |
Returns
A Range object
createRange(number, number, number, number)
Creates a Range object from a range of cells.
createRange(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number) : Range;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstRow | number | First row of this range |
| firstColumn | number | First column of this range |
| totalRows | number | Number of rows |
| totalColumns | number | Number of columns |
Returns
A Range object
createRange(string)
Creates a Range object from an address of the range.
createRange(address: string) : Range;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| address | string | The address of the range. |
Returns
A Range object
createRange(number, number, boolean)
Creates a Range object from rows of cells or columns of cells.
createRange(firstIndex: number, number: number, isVertical: boolean) : Range;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | First row index or first column index, zero based. |
| number | number | 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
A Range object.
clear()
Clears all data of the worksheet.
clear() : void;
importFormulaArray(string[], number, number, boolean)
Imports an array of formula into a worksheet.
importFormulaArray(stringArray: string[], firstRow: number, firstColumn: number, isVertical: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stringArray | string[] | Formula array. |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
| isVertical | boolean | Specifies to import data vertically or horizontally. |
textToColumns(number, number, number, TxtLoadOptions)
Splits content in specified column into multiple columns..
textToColumns(row: number, column: number, totalRows: number, options: TxtLoadOptions) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | The row index. |
| column | number | The column index. |
| totalRows | number | The number of rows. |
| options | TxtLoadOptions | The split options. |
Returns
Total column count of the split values.
importCSV(string, string, boolean, number, number)
Import a CSV file to the cells.
importCSV(fileName: string, splitter: string, convertNumericData: boolean, firstRow: number, firstColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fileName | string | The CSV file name. |
| splitter | string | The splitter |
| convertNumericData | boolean | Whether the string in text file is converted to numeric data. |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
importCSV(Uint8Array, string, boolean, number, number)
Import a CSV file to the cells.
importCSV(stream: Uint8Array, splitter: string, convertNumericData: boolean, firstRow: number, firstColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | Uint8Array | The CSV file stream. |
| splitter | string | The splitter |
| convertNumericData | boolean | Whether the string in text file is converted to numeric data. |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
importCSV(string, TxtLoadOptions, number, number)
Import a CSV file to the cells.
importCSV(fileName: string, options: TxtLoadOptions, firstRow: number, firstColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fileName | string | The CSV file name. |
| options | TxtLoadOptions | The load options for reading text file |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
importCSV(Uint8Array, TxtLoadOptions, number, number)
Import a CSV file to the cells.
importCSV(stream: Uint8Array, options: TxtLoadOptions, firstRow: number, firstColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | Uint8Array | The CSV file stream. |
| options | TxtLoadOptions | The load options for reading text file |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
importCSVAsync(string, string, boolean, number, number)
Import a CSV file to the cells.
importCSVAsync(fileName: string, splitter: string, convertNumericData: boolean, firstRow: number, firstColumn: number) : Promise<void>;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fileName | string | The CSV file name. |
| splitter | string | The splitter |
| convertNumericData | boolean | Whether the string in text file is converted to numeric data. |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
Returns
importCSVAsync(Uint8Array, string, boolean, number, number)
Import a CSV file to the cells.
importCSVAsync(stream: Uint8Array, splitter: string, convertNumericData: boolean, firstRow: number, firstColumn: number) : Promise<void>;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | Uint8Array | The CSV file stream. |
| splitter | string | The splitter |
| convertNumericData | boolean | Whether the string in text file is converted to numeric data. |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
Returns
importCSVAsync(string, TxtLoadOptions, number, number)
Import a CSV file to the cells.
importCSVAsync(fileName: string, options: TxtLoadOptions, firstRow: number, firstColumn: number) : Promise<void>;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fileName | string | The CSV file name. |
| options | TxtLoadOptions | The load options for reading text file |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
Returns
importCSVAsync(Uint8Array, TxtLoadOptions, number, number)
Import a CSV file to the cells.
importCSVAsync(stream: Uint8Array, options: TxtLoadOptions, firstRow: number, firstColumn: number) : Promise<void>;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | Uint8Array | The CSV file stream. |
| options | TxtLoadOptions | The load options for reading text file |
| firstRow | number | The row number of the first cell to import in. |
| firstColumn | number | The column number of the first cell to import in. |
Returns
merge(number, number, number, number)
Merges a specified range of cells into a single cell.
merge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstRow | number | First row of this range(zero based) |
| firstColumn | number | First column of this range(zero based) |
| totalRows | number | Number of rows(one based) |
| totalColumns | number | Number of columns(one based) |
Remarks
Reference the merged cell via the address of the upper-left cell in the range.
merge(number, number, number, number, boolean)
Merges a specified range of cells into a single cell.
merge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number, mergeConflict: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstRow | number | First row of this range(zero based) |
| firstColumn | number | First column of this range(zero based) |
| totalRows | number | Number of rows(one based) |
| totalColumns | number | Number of columns(one based) |
| mergeConflict | boolean | Merge conflict merged ranges. |
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.
merge(number, number, number, number, boolean, boolean)
Merges a specified range of cells into a single cell.
merge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number, checkConflict: boolean, mergeConflict: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstRow | number | First row of this range(zero based) |
| firstColumn | number | First column of this range(zero based) |
| totalRows | number | Number of rows(one based) |
| totalColumns | number | Number of columns(one based) |
| checkConflict | boolean | Indicates whether check the merged cells intersects other merged cells |
| mergeConflict | boolean | Merge conflict merged ranges. |
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.
unMerge(number, number, number, number)
Unmerges a specified range of merged cells.
unMerge(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstRow | number | First row of this range(zero based) |
| firstColumn | number | First column of this range(zero based) |
| totalRows | number | Number of rows(one based) |
| totalColumns | number | Number of columns(one based) |
clearMergedCells()
Clears all merged ranges.
clearMergedCells() : void;
hideRow(number)
Hides a row.
hideRow(row: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
unhideRow(number, number)
Unhides a row.
unhideRow(row: number, height: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
| height | number | Row height. The row’s height will be changed only when the row is hidden and given height value is positive. |
hideRows(number, number)
Hides multiple rows.
hideRows(row: number, totalRows: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | The row index. |
| totalRows | number | The row number. |
unhideRows(number, number, number)
Unhides the hidden rows.
unhideRows(row: number, totalRows: number, height: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | The row index. |
| totalRows | number | The row number. |
| height | number | Row height. The row’s height will be changed only when the row is hidden and given height value is positive. |
setRowHeightPixel(number, number)
Sets row height in unit of pixels.
setRowHeightPixel(row: number, pixels: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
| pixels | number | Number of pixels. |
setRowHeightInch(number, number)
Sets row height in unit of inches.
setRowHeightInch(row: number, inches: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
| inches | number | Number of inches. It should be between 0 and 409.5/72. |
setRowHeight(number, number)
Sets the height of the specified row.
setRowHeight(row: number, height: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
| height | number | Height of row.In unit of point It should be between 0 and 409.5. |
getRowHeight(number, boolean, CellsUnitType)
Gets row’s height.
getRowHeight(row: number, isOriginal: boolean, unitType: CellsUnitType) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | The row index. |
| isOriginal | boolean | Whether returns the original row height or 0 for hidden row. |
| unitType | CellsUnitType | Unit type of the returned height value |
Returns
Row’s height
getRowHeight(number)
Gets the height of a specified row, in unit of points.
getRowHeight(row: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
Returns
Height of row
getRowOriginalHeightPoint(number)
Gets original row’s height in unit of point if the row is hidden
getRowOriginalHeightPoint(row: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | The row index. |
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.
getColumnWidth(number, boolean, CellsUnitType)
Gets the column width.
getColumnWidth(column: number, isOriginal: boolean, unitType: CellsUnitType) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | The column index. |
| isOriginal | boolean | Indicates whether getting original width. |
| unitType | CellsUnitType |
getColumnWidth(number)
Gets the width(in unit of characters) of the specified column in normal view
getColumnWidth(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index |
Returns
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.
getColumnOriginalWidthPoint(number)
Gets original column’s height in unit of point if the column is hidden
getColumnOriginalWidthPoint(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | The row index. |
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.
hideColumn(number)
Hides a column.
hideColumn(column: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
unhideColumn(number, number)
Unhides a column
unhideColumn(column: number, width: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
| width | number | Column width. |
hideColumns(number, number)
Hide multiple columns.
hideColumns(column: number, totalColumns: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
| totalColumns | number | Column number. |
unhideColumns(number, number, number)
Unhide multiple columns.
unhideColumns(column: number, totalColumns: number, width: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
| totalColumns | number | Column number |
| width | number | Column width. |
Remarks
Only applies the column width to the hidden columns.
getViewRowHeight(number)
Gets the height of a specified row.
getViewRowHeight(row: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index. |
Returns
Height of row.
getRowHeightInch(number)
Gets the height of a specified row in unit of inches.
getRowHeightInch(row: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
Returns
Height of row
getViewRowHeightInch(number)
Gets the height of a specified row in unit of inches.
getViewRowHeightInch(row: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
Returns
Height of row
getRowHeightPixel(number)
Gets the height of a specified row in unit of pixel.
getRowHeightPixel(row: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index |
Returns
Height of row
setColumnWidthPixel(number, number)
Sets column width in unit of pixels in normal view.
setColumnWidthPixel(column: number, pixels: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
| pixels | number | Number of pixels. |
setColumnWidthInch(number, number)
Sets column width in unit of inches in normal view.
setColumnWidthInch(column: number, inches: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
| inches | number | Number of inches. |
setColumnWidth(number, number)
Sets the width of the specified column in normal view.
setColumnWidth(column: number, width: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
| width | number | Width of column in unit of characters.Column width must be between 0 and 255. |
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.
getColumnWidthPixel(number)
Gets the width of the specified column in normal view, in units of pixel.
getColumnWidthPixel(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index |
Returns
Width of column in normal view.
getColumnWidthPixel(number, boolean)
Gets the width of the specified column in normal view, in units of pixel.
getColumnWidthPixel(column: number, original: boolean) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index |
| original | boolean | Indicates whether returning original width even when the column is hidden |
Returns
Width of column in normal view.
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.
getColumnWidthInch(number)
Gets the width of the specified column in normal view, in units of inches.
getColumnWidthInch(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index |
Returns
Width of 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.
getViewColumnWidthPixel(number)
Get the width in different view type.
getViewColumnWidthPixel(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | The column index. |
Returns
the column width in unit of pixels
setViewColumnWidthPixel(number, number)
Sets the width of the column in different view.
setViewColumnWidthPixel(column: number, pixels: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | The column index. |
| pixels | number | The width in unit of pixels. |
Remarks
If the current view type is ViewType.PageLayoutView, the column’s width is same as printed width.
getLastDataRow(number)
Gets the last row index of cell which contains data in the specified column.
getLastDataRow(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
Returns
last row index.
getFirstDataRow(number)
Gets the first row index of cell which contains data in the specified column.
getFirstDataRow(column: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | Column index. |
Returns
first row index.
applyColumnStyle(number, Style, StyleFlag)
Applies formats for a whole column.
applyColumnStyle(column: number, style: Style, flag: StyleFlag) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| column | number | The column index. |
| style | Style | The style object which will be applied. |
| flag | StyleFlag | Flags which indicates applied formatting properties. |
applyRowStyle(number, Style, StyleFlag)
Applies formats for a whole row.
applyRowStyle(row: number, style: Style, flag: StyleFlag) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | The row index. |
| style | Style | The style object which will be applied. |
| flag | StyleFlag | Flags which indicates applied formatting properties. |
applyStyle(Style, StyleFlag)
Applies formats for a whole worksheet.
applyStyle(style: Style, flag: StyleFlag) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| style | Style | The style object which will be applied. |
| flag | StyleFlag | Flags which indicates applied formatting properties. |
copyColumns(Cells, number, number, number, PasteOptions)
Copies data and formats of a whole column.
copyColumns(sourceCells: Cells, sourceColumnIndex: number, destinationColumnIndex: number, columnNumber: number, pasteOptions: PasteOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceColumnIndex | number | Source column index. |
| destinationColumnIndex | number | Destination column index. |
| columnNumber | number | The copied column number. |
| pasteOptions | PasteOptions | the options of pasting. |
copyColumns(Cells, number, number, number)
Copies data and formats of whole columns.
copyColumns(sourceCells: Cells, sourceColumnIndex: number, destinationColumnIndex: number, columnNumber: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceColumnIndex | number | Source column index. |
| destinationColumnIndex | number | Destination column index. |
| columnNumber | number | The copied column number. |
copyColumns(Cells, number, number, number, number)
Copies data and formats of the whole columns.
copyColumns(sourceCells: Cells, sourceColumnIndex: number, sourceTotalColumns: number, destinationColumnIndex: number, destinationTotalColumns: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceColumnIndex | number | Source column index. |
| sourceTotalColumns | number | The number of the source columns. |
| destinationColumnIndex | number | Destination column index. |
| destinationTotalColumns | number | The number of the destination columns. |
copyColumn(Cells, number, number)
Copies data and formats of a whole column.
copyColumn(sourceCells: Cells, sourceColumnIndex: number, destinationColumnIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceColumnIndex | number | Source column index. |
| destinationColumnIndex | number | Destination column index. |
copyRow(Cells, number, number)
Copies data and formats of a whole row.
copyRow(sourceCells: Cells, sourceRowIndex: number, destinationRowIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceRowIndex | number | Source row index. |
| destinationRowIndex | number | Destination row index. |
copyRows(Cells, number, number, number)
Copies data and formats of some whole rows.
copyRows(sourceCells: Cells, sourceRowIndex: number, destinationRowIndex: number, rowNumber: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceRowIndex | number | Source row index. |
| destinationRowIndex | number | Destination row index. |
| rowNumber | number | The copied row number. |
copyRows(Cells, number, number, number, CopyOptions)
Copies data and formats of some whole rows.
copyRows(sourceCells: Cells, sourceRowIndex: number, destinationRowIndex: number, rowNumber: number, copyOptions: CopyOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells | Cells | Source Cells object contains data and formats to copy. |
| sourceRowIndex | number | Source row index. |
| destinationRowIndex | number | Destination row index. |
| rowNumber | number | The copied row number. |
| copyOptions | CopyOptions | The copy options. |
copyRows(Cells, number, number, number, CopyOptions, PasteOptions)
Copies data and formats of some whole rows.
copyRows(sourceCells0: Cells, sourceRowIndex: number, destinationRowIndex: number, rowNumber: number, copyOptions: CopyOptions, pasteOptions: PasteOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceCells0 | Cells | Source Cells object contains data and formats to copy. |
| sourceRowIndex | number | Source row index. |
| destinationRowIndex | number | Destination row index. |
| rowNumber | number | The copied row number. |
| copyOptions | CopyOptions | The copy options. |
| pasteOptions | PasteOptions | the options of pasting. |
getGroupedRowOutlineLevel(number)
Gets the outline level (zero-based) of the row.
getGroupedRowOutlineLevel(rowIndex: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | The row index. |
Returns
The outline level (zero-based) of the row.
Remarks
If the row is not grouped, returns zero.
getGroupedColumnOutlineLevel(number)
Gets the outline level (zero-based) of the column.
getGroupedColumnOutlineLevel(columnIndex: number) : number;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | The column index |
Returns
The outline level of the column
Remarks
If the column is not grouped, returns zero.
getMaxGroupedColumnOutlineLevel()
Gets the max grouped column outline level (zero-based).
getMaxGroupedColumnOutlineLevel() : number;
Returns
The max grouped column outline level (zero-based)
getMaxGroupedRowOutlineLevel()
Gets the max grouped row outline level (zero-based).
getMaxGroupedRowOutlineLevel() : number;
Returns
The max grouped row outline level (zero-based)
showGroupDetail(boolean, number)
Expands the grouped rows/columns.
showGroupDetail(isVertical: boolean, index: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| isVertical | boolean | True, expands the grouped rows. |
| index | number | The row/column index |
hideGroupDetail(boolean, number)
Collapses the grouped rows/columns.
hideGroupDetail(isVertical: boolean, index: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| isVertical | boolean | True, collapse the grouped rows. |
| index | number | The row/column index |
ungroupColumns(number, number)
Ungroups columns.
ungroupColumns(firstIndex: number, lastIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first column index to be ungrouped. |
| lastIndex | number | The last column index to be ungrouped. |
groupColumns(number, number)
Groups columns.
groupColumns(firstIndex: number, lastIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first column index to be grouped. |
| lastIndex | number | The last column index to be grouped. |
groupColumns(number, number, boolean)
Groups columns.
groupColumns(firstIndex: number, lastIndex: number, isHidden: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first column index to be grouped. |
| lastIndex | number | The last column index to be grouped. |
| isHidden | boolean | Specifies if the grouped columns are hidden. |
ungroupRows(number, number, boolean)
Ungroups rows.
ungroupRows(firstIndex: number, lastIndex: number, isAll: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first row index to be ungrouped. |
| lastIndex | number | The last row index to be ungrouped. |
| isAll | boolean | True, removes all grouped info.Otherwise, remove the outer group info. |
ungroupRows(number, number)
Ungroups rows.
ungroupRows(firstIndex: number, lastIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first row index to be ungrouped. |
| lastIndex | number | The last row index to be ungrouped. |
Remarks
Only removes outer group info.
groupRows(number, number, boolean)
Groups rows.
groupRows(firstIndex: number, lastIndex: number, isHidden: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first row index to be grouped. |
| lastIndex | number | The last row index to be grouped. |
| isHidden | boolean | Specifies if the grouped rows are hidden. |
groupRows(number, number)
Groups rows.
groupRows(firstIndex: number, lastIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstIndex | number | The first row index to be grouped. |
| lastIndex | number | The last row index to be grouped. |
deleteColumn(number, boolean)
Deletes a column.
deleteColumn(columnIndex: number, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Index of the column to be deleted. |
| updateReference | boolean | Indicates whether update references in other worksheets. |
deleteColumn(number)
Deletes a column.
deleteColumn(columnIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Index of the column to be deleted. |
deleteColumns(number, number, boolean)
Deletes several columns.
deleteColumns(columnIndex: number, totalColumns: number, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Index of the first column to be deleted. |
| totalColumns | number | Count of columns to be deleted. |
| updateReference | boolean | Indicates whether update references in other worksheets. |
deleteColumns(number, number, DeleteOptions)
Deletes several columns.
deleteColumns(columnIndex: number, totalColumns: number, options: DeleteOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Index of the first column to be deleted. |
| totalColumns | number | Count of columns to be deleted. |
| options | DeleteOptions | Options for the deleting operation |
isDeletingRangeEnabled(number, number, number, number)
Check whether the range could be deleted.
isDeletingRangeEnabled(startRow: number, startColumn: number, totalRows: number, totalColumns: number) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | The start row index of the range. |
| startColumn | number | The start column index of the range. |
| totalRows | number | The number of the rows in the range. |
| totalColumns | number | The number of the columns in the range. |
deleteRow(number)
Deletes a row.
deleteRow(rowIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Index of the row to be deleted. |
deleteRow(number, boolean)
Deletes a row.
deleteRow(rowIndex: number, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Index of the row to be deleted. |
| updateReference | boolean | Indicates whether update references in other worksheets. |
deleteRows(number, number)
Deletes multiple rows.
deleteRows(rowIndex: number, totalRows: number) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | The first row index to be deleted. |
| totalRows | number | Count of rows to be deleted. |
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.
deleteRows(number, number, boolean)
Deletes multiple rows in the worksheet.
deleteRows(rowIndex: number, totalRows: number, updateReference: boolean) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Index of the first row to be deleted. |
| totalRows | number | Count of rows to be deleted. |
| updateReference | boolean | Indicates whether update references in other worksheets. |
deleteRows(number, number, DeleteOptions)
Deletes multiple rows in the worksheet.
deleteRows(rowIndex: number, totalRows: number, options: DeleteOptions) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Index of the first row to be deleted. |
| totalRows | number | Count of rows to be deleted. |
| options | DeleteOptions | Options for the deleting operation |
deleteBlankColumns()
Delete all blank columns which do not contain any data.
deleteBlankColumns() : void;
deleteBlankColumns(DeleteOptions)
Delete all blank columns which do not contain any data.
deleteBlankColumns(options: DeleteOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | DeleteOptions | The options of deleting range. |
isBlankColumn(number)
Checks whether given column is blank(does not contain any data).
isBlankColumn(columnIndex: number) : boolean;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | the column index |
Returns
true if given column does not contain any data
deleteBlankRows()
Delete all blank rows which do not contain any data or other object.
deleteBlankRows() : void;
deleteBlankRows(DeleteOptions)
Delete all blank rows which do not contain any data or some special objects such as visible comment, pivot table.
deleteBlankRows(options: DeleteOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| options | DeleteOptions | The options of deleting range. |
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.
insertColumns(number, number)
Inserts some columns into the worksheet.
insertColumns(columnIndex: number, totalColumns: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Column index. |
| totalColumns | number | The number of columns. |
insertColumns(number, number, boolean)
Inserts some columns into the worksheet.
insertColumns(columnIndex: number, totalColumns: number, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Column index. |
| totalColumns | number | The number of columns. |
| updateReference | boolean | Indicates if references in other worksheets will be updated. |
insertColumns(number, number, InsertOptions)
Inserts some columns into the worksheet.
insertColumns(columnIndex: number, totalColumns: number, options: InsertOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Column index. |
| totalColumns | number | The number of columns. |
| options | InsertOptions | The options for inserting operation. |
insertColumn(number, boolean)
Inserts a new column into the worksheet.
insertColumn(columnIndex: number, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Column index. |
| updateReference | boolean | Indicates if references in other worksheets will be updated. |
insertColumn(number)
Inserts a new column into the worksheet.
insertColumn(columnIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Column index. |
insertRows(number, number, boolean)
Inserts multiple rows into the worksheet.
insertRows(rowIndex: number, totalRows: number, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Row index. |
| totalRows | number | Number of rows to be inserted. |
| updateReference | boolean | Indicates if references in other worksheets will be updated. |
insertRows(number, number, InsertOptions)
Inserts multiple rows into the worksheet.
insertRows(rowIndex: number, totalRows: number, options: InsertOptions) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Row index. |
| totalRows | number | Number of rows to be inserted. |
| options | InsertOptions | Options for inserting operation. |
insertRows(number, number)
Inserts multiple rows into the worksheet.
insertRows(rowIndex: number, totalRows: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Row index. |
| totalRows | number | Number of rows to be inserted. |
insertRow(number)
Inserts a new row into the worksheet.
insertRow(rowIndex: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Row index. |
clearRange(CellArea)
Clears contents and formatting of a range.
clearRange(range: CellArea) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| range | CellArea | Range to be cleared. |
clearRange(number, number, number, number)
Clears contents and formatting of a range.
clearRange(startRow: number, startColumn: number, endRow: number, endColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | Start row index. |
| startColumn | number | Start column index. |
| endRow | number | End row index. |
| endColumn | number | End column index. |
clearContents(CellArea)
Clears contents of a range.
clearContents(range: CellArea) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| range | CellArea | Range to be cleared. |
clearContents(number, number, number, number)
Clears contents of a range.
clearContents(startRow: number, startColumn: number, endRow: number, endColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | Start row index. |
| startColumn | number | Start column index. |
| endRow | number | End row index. |
| endColumn | number | End column index. |
clearFormats(CellArea)
Clears formatting of a range.
clearFormats(range: CellArea) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| range | CellArea | Range to be cleared. |
clearFormats(number, number, number, number)
Clears formatting of a range.
clearFormats(startRow: number, startColumn: number, endRow: number, endColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | Start row index. |
| startColumn | number | Start column index. |
| endRow | number | End row index. |
| endColumn | number | End column index. |
linkToXmlMap(string, number, number, string)
Link to a xml map.
linkToXmlMap(mapName: string, row: number, column: number, path: string) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| mapName | string | name of xml map |
| row | number | row of the destination cell |
| column | number | column of the destination cell |
| path | string | path of xml element in xml map |
find(Object, Cell)
Finds the cell containing with the input object.
find(what: Object, previousCell: Cell) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| what | 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 object.
Remarks
Returns null (Nothing) if no cell is found.
find(Object, Cell, FindOptions)
Finds the cell containing with the input object.
find(what: Object, previousCell: Cell, findOptions: FindOptions) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| what | 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 object.
Remarks
Returns null (Nothing) if no cell is found.
endCellInRow(number)
Gets the last cell in this row.
endCellInRow(rowIndex: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rowIndex | number | Row index. |
Returns
Cell object.
endCellInRow(number, number, number, number)
Gets the last cell with maximum row index in this range.
endCellInRow(startRow: number, endRow: number, startColumn: number, endColumn: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | Start row index. |
| endRow | number | End row index. |
| startColumn | number | Start column index. |
| endColumn | number | End column index. |
Returns
Cell object.
endCellInColumn(number)
Gets the last cell in this column.
endCellInColumn(columnIndex: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| columnIndex | number | Column index. |
Returns
Cell object.
endCellInColumn(number, number, number, number)
Gets the last cell with maximum column index in this range.
endCellInColumn(startRow: number, endRow: number, startColumn: number, endColumn: number) : Cell;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | Start row index. |
| endRow | number | End row index. |
| startColumn | number | Start column index. |
| endColumn | number | End column index. |
Returns
Cell object.
moveRange(CellArea, number, number)
Moves the range.
moveRange(sourceArea: CellArea, destRow: number, destColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| sourceArea | CellArea | The range which should be moved. |
| destRow | number | The dest row. |
| destColumn | number | The dest column. |
insertCutCells(Range, number, number, ShiftType)
Insert cut range.
insertCutCells(cutRange: Range, row: number, column: number, shiftType: ShiftType) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| cutRange | Range | The cut range. |
| row | number | The row. |
| column | number | The column. |
| shiftType | ShiftType | Indicates how to shift other objects of the target range when inserting cut range. |
insertRange(CellArea, number, ShiftType, boolean)
Inserts a range of cells and shift cells according to the shift option.
insertRange(area: CellArea, shiftNumber: number, shiftType: ShiftType, updateReference: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| area | CellArea | Shift area. |
| shiftNumber | number | Number of rows or columns to be inserted. |
| shiftType | ShiftType | Shift cells option. |
| updateReference | boolean | Indicates whether update references in other worksheets. |
insertRange(CellArea, ShiftType)
Inserts a range of cells and shift cells according to the shift option.
insertRange(area: CellArea, shiftType: ShiftType) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| area | CellArea | Shift area. |
| shiftType | ShiftType | Shift cells option. |
insertRange(CellArea, number, ShiftType)
Inserts a range of cells and shift cells according to the shift option.
insertRange(area: CellArea, shiftNumber: number, shiftType: ShiftType) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| area | CellArea | Shift area. |
| shiftNumber | number | Number of rows or columns to be inserted. |
| shiftType | ShiftType | Shift cells option. |
deleteRange(number, number, number, number, ShiftType)
Deletes a range of cells and shift cells according to the shift option.
deleteRange(startRow: number, startColumn: number, endRow: number, endColumn: number, shiftType: ShiftType) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | Start row index. |
| startColumn | number | Start column index. |
| endRow | number | End row index. |
| endColumn | number | End column index. |
| shiftType | ShiftType | Shift cells option. |
exportArray(number, number, number, number)
Exports data in the Cells collection to a two-dimension array object.
exportArray(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number) : Object[][];
Parameters:
| Parameter | Type | Description |
|---|---|---|
| firstRow | number | The row number of the first cell to export out. |
| firstColumn | number | The column number of the first cell to export out. |
| totalRows | number | Number of rows to be exported |
| totalColumns | number | Number of columns to be exported |
Returns
Exported cell value array object.
retrieveSubtotalSetting(CellArea)
Retrieves subtotals setting of the range.
retrieveSubtotalSetting(ca: CellArea) : SubtotalSetting;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| ca | CellArea | The range |
Returns
subtotal(CellArea, number, ConsolidationFunction, number[])
Creates subtotals for the range.
subtotal(ca: CellArea, groupBy: number, consolidationFunction: ConsolidationFunction, totalList: number[]) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| ca | CellArea | The range |
| groupBy | number | The field to group by, as a zero-based integer offset |
| consolidationFunction | ConsolidationFunction | The subtotal function. |
| totalList | number[] | An array of zero-based field offsets, indicating the fields to which the subtotals are added. |
subtotal(CellArea, number, ConsolidationFunction, number[], boolean, boolean, boolean)
Creates subtotals for the range.
subtotal(ca: CellArea, groupBy: number, consolidationFunction: ConsolidationFunction, totalList: number[], replace: boolean, pageBreaks: boolean, summaryBelowData: boolean) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| ca | CellArea | The range |
| groupBy | number | The field to group by, as a zero-based integer offset |
| consolidationFunction | ConsolidationFunction | The subtotal function. |
| totalList | number[] | 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. |
removeFormulas()
Removes all formula and replaces with the value of the formula.
removeFormulas() : void;
removeDuplicates()
Removes duplicate rows in the sheet.
removeDuplicates() : void;
removeDuplicates(number, number, number, number)
Removes duplicate values in the range.
removeDuplicates(startRow: number, startColumn: number, endRow: number, endColumn: number) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | The start row. |
| startColumn | number | The start column |
| endRow | number | The end row index. |
| endColumn | number | The end column index. |
removeDuplicates(number, number, number, number, boolean, number[])
Removes duplicate data of the range.
removeDuplicates(startRow: number, startColumn: number, endRow: number, endColumn: number, hasHeaders: boolean, columnOffsets: number[]) : void;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| startRow | number | The start row. |
| startColumn | number | The start column |
| endRow | number | The end row index. |
| endColumn | number | The end column index. |
| hasHeaders | boolean | Indicates whether the range contains headers. |
| columnOffsets | number[] | The column offsets. |
convertStringToNumericValue()
Converts all string data in the worksheet to numeric value if possible.
convertStringToNumericValue() : void;
getDependents(boolean, number, number)
Get all cells which refer to the specific cell.
getDependents(isAll: boolean, row: number, column: number) : Cell[];
Parameters:
| Parameter | Type | Description |
|---|---|---|
| isAll | boolean | Indicates whether check other worksheets |
| row | number | The row index. |
| column | number | The column index. |
Returns
Cell[]
getDependentsInCalculation(number, number, boolean)
Gets all cells whose calculated result depends on specific cell.
getDependentsInCalculation(row: number, column: number, recursive: boolean) : CellEnumerator;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | Row index of the specific cell |
| column | number | 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
Enumerator to enumerate all dependents(Cell objects)
Remarks
To use this method, please make sure the workbook has been set with true value for FormulaSettings.EnableCalculationChain 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(bool)
getCellsWithPlaceInCellPicture()
Gets all cells that contain embedded picture.
getCellsWithPlaceInCellPicture() : CellEnumerator;
Returns
Enumerator to enumerate all Cell objects that contain embedded picture
Remarks
If there is no picture which is set as “Place in Cell” in this worksheet, null will be returned.
getCellStyle(number, number)
Get the style of given cell.
getCellStyle(row: number, column: number) : Style;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | row index |
| column | number | column |
Returns
the style of given cell.
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.
getCellDisplayStyle(number, number)
Get the display style of given cell.
getCellDisplayStyle(row: number, column: number) : Style;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | row index of given cell |
| column | number | column of given cell |
Returns
the display style of given cell.
Remarks
Same with Cell.GetDisplayStyle(), and same with using BorderType.SideBorders for [GetCellDisplayStyle(int, int, BorderType)](../getcelldisplaystyle(int, int, bordertype)/).
getCellDisplayStyle(number, number, BorderType)
Get the display style of given cell.
getCellDisplayStyle(row: number, column: number, adjacentBorders: BorderType) : Style;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| row | number | row index of given cell |
| column | number | column of given cell |
| adjacentBorders | 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(BorderType). |
Returns
the display style of given cell.
Remarks
If the cell is also affected by other settings such as conditional formatting, list objects, etc., then the display style may be different from [GetCellStyle(int, int)](../getcellstyle(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(BorderType).
isNull()
Checks whether the implementation object is null.
isNull() : boolean;