Row

Row class

Represents a single row in a worksheet.

class Row;

Methods

MethodDescription
get(number)Gets the cell.
isBlank()Indicates whether the row contains any data
isCollapsed()whether the row is collapsed
setIsCollapsed(boolean)whether the row is collapsed
getHeight()Gets and sets the row height in unit of Points.
setHeight(number)Gets and sets the row height in unit of Points.
isHidden()Indicates whether the row is hidden.
setIsHidden(boolean)Indicates whether the row is hidden.
getIndex()Gets the index of this row.
getGroupLevel()Gets the group level of the row.
setGroupLevel(number)Gets the group level of the row.
isHeightMatched()Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user.
setIsHeightMatched(boolean)Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user.
getHasCustomStyle()Indicates whether this row has custom style settings(different from the default one inherited from workbook).
getFirstCell()Gets the first cell object in the row.
getFirstDataCell()Gets the first non-blank cell in the row.
getLastCell()Gets the last cell object in the row.
getLastDataCell()Gets the last non-blank cell in the row.
getCellByIndex(number)Get the cell by specific index in the cells collection of this row.
getEnumerator()Gets the cells enumerator
getEnumerator(boolean, boolean)Gets an enumerator that iterates cells through this row.
getCellOrNull(number)Gets the cell or null in the specific index.
getStyle()Gets the style of this row.
setStyle(Style)Sets the style of this row.
copySettings(Row, boolean)Copy settings of row, such as style, height, visibility, …etc.
applyStyle(Style, StyleFlag)Applies formats for a whole row.
equals(object)Checks whether this object refers to the same row with another.
equals(Row)Checks whether this object refers to the same row with another row object.
isNull()Checks whether the implementation object is null.

get(number)

Gets the cell.

get(column: number) : Cell;

Parameters:

ParameterTypeDescription
columnnumberThe column index

Returns

Cell

isBlank()

Indicates whether the row contains any data

isBlank() : boolean;

isCollapsed()

whether the row is collapsed

isCollapsed() : boolean;

setIsCollapsed(boolean)

whether the row is collapsed

setIsCollapsed(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getHeight()

Gets and sets the row height in unit of Points.

getHeight() : number;

setHeight(number)

Gets and sets the row height in unit of Points.

setHeight(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

isHidden()

Indicates whether the row is hidden.

isHidden() : boolean;

setIsHidden(boolean)

Indicates whether the row is hidden.

setIsHidden(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getIndex()

Gets the index of this row.

getIndex() : number;

getGroupLevel()

Gets the group level of the row.

getGroupLevel() : number;

setGroupLevel(number)

Gets the group level of the row.

setGroupLevel(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

isHeightMatched()

Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user.

isHeightMatched() : boolean;

Remarks

When this property is true, if the content in this row changes, generally the row height needs to be re-calculated(such as by Worksheet.AutoFitRows()) to get the same result with what is shown in ms excel when you opening the workbook in it.

setIsHeightMatched(boolean)

Indicates whether the row height matches current default font setting of the workbook. True of this property also denotes the row height is “automatic” without custom height value set by user.

setIsHeightMatched(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

When this property is true, if the content in this row changes, generally the row height needs to be re-calculated(such as by Worksheet.AutoFitRows()) to get the same result with what is shown in ms excel when you opening the workbook in it.

getHasCustomStyle()

Indicates whether this row has custom style settings(different from the default one inherited from workbook).

getHasCustomStyle() : boolean;

getFirstCell()

Gets the first cell object in the row.

getFirstCell() : Cell;

Returns

Cell

getFirstDataCell()

Gets the first non-blank cell in the row.

getFirstDataCell() : Cell;

Returns

Cell

getLastCell()

Gets the last cell object in the row.

getLastCell() : Cell;

Returns

Cell

getLastDataCell()

Gets the last non-blank cell in the row.

getLastDataCell() : Cell;

Returns

Cell

getCellByIndex(number)

Get the cell by specific index in the cells collection of this row.

getCellByIndex(index: number) : Cell;

Parameters:

ParameterTypeDescription
indexnumberThe index(position) of the cell in the cells collection of this row.

Returns

The Cell object at given position.

Remarks

To traverse all cells in sequence without modification, using GetEnumerator() will give better performance than using this method to get cell one by one.

getEnumerator()

Gets the cells enumerator

getEnumerator() : CellEnumerator;

Returns

The cells enumerator

getEnumerator(boolean, boolean)

Gets an enumerator that iterates cells through this row.

getEnumerator(reversed: boolean, sync: boolean) : CellEnumerator;

Parameters:

ParameterTypeDescription
reversedbooleanwhether enumerate cells in reversed order
syncbooleanwhether the returned enumerator should check the modification of cells in this row /// and keep synchronized with it.

Returns

The cell enumerator

Remarks

If the row will be modified(by operations that may cause new Cell be instantiated or existing Cell be removed) during the traversal with the enumerator, synchronized enumerator should be used instead of normal enumerator so that the traversal can continue from the position just after the one has been traversed by the last MoveNext(). However, together with the advantage that no element be skipped or traversed repeatedly, the disadvantage for synchronized enumerator is that the performance will be degraded a bit when comparing with normal enumerator.

getCellOrNull(number)

Gets the cell or null in the specific index.

getCellOrNull(column: number) : Cell;

Parameters:

ParameterTypeDescription
columnnumberThe column index

Returns

Returns the cell object if the cell exists. Or returns null if the cell object does not exist.

getStyle()

Gets the style of this row.

getStyle() : Style;

Returns

Style

Remarks

Modifying the returned style object directly takes no effect for this row or any cells in this row. You have to call [ApplyStyle(Style, StyleFlag)](../applystyle(style, styleflag)/) or SetStyle(Style) method to apply the change to this row.

Row’s style is the style which will be inherited by cells in this row(those cells that have no custom style settings, such as existing cells that have not been set style explicitly, or those that have not been instantiated)

setStyle(Style)

Sets the style of this row.

setStyle(style: Style) : void;

Parameters:

ParameterTypeDescription
styleStylethe style to be used as the default style for cells in this row.

Remarks

This method only sets the given style as the default style for this row, without changing the style settings for existing cells in this row. To update style settings of existing cells to the specified style at the same time, please use [ApplyStyle(Style, StyleFlag)](../applystyle(style, styleflag)/)

copySettings(Row, boolean)

Copy settings of row, such as style, height, visibility, …etc.

copySettings(source: Row, checkStyle: boolean) : void;

Parameters:

ParameterTypeDescription
sourceRowthe source row whose settings will be copied to this one
checkStylebooleanwhether check and gather style. /// Only takes effect and be needed when two row objects belong to different workbook and the styles of two workbooks are different.

applyStyle(Style, StyleFlag)

Applies formats for a whole row.

applyStyle(style: Style, flag: StyleFlag) : void;

Parameters:

ParameterTypeDescription
styleStyleThe style object which will be applied.
flagStyleFlagFlags which indicates applied formatting properties.

equals(object)

Checks whether this object refers to the same row with another.

equals(obj: object) : boolean;

Parameters:

ParameterTypeDescription
objobjectanother object

Returns

true if two objects refers to the same row.

equals(Row)

Checks whether this object refers to the same row with another row object.

equals(row: Row) : boolean;

Parameters:

ParameterTypeDescription
rowRowanother row object

Returns

true if two row objects refers to the same row.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;