@univerjs/sheets v0.5.0-beta.1Docs


Class: FRange

FBase is a base class for all facade classes. It provides a way to extend classes with static and instance methods. The _initialize as a special method that will be called after the constructor. You should never call it directly.

Extends

Constructors

new FRange()

new FRange(
   _workbook, 
   _worksheet, 
   _range, 
   _injector, 
   _commandService, 
   _formulaDataModel): FRange

Parameters

ParameterType
_workbookWorkbook
_worksheetWorksheet
_rangeIRange
_injectorInjector
_commandServiceICommandService
_formulaDataModelFormulaDataModel

Returns

FRange

Overrides

FBase.constructor

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:30

Properties

PropertyModifierTypeDefined in
_commandServicereadonlyICommandServicesubmodules/univer/packages/sheets/src/facade/f-range.ts:35
_formulaDataModelreadonlyFormulaDataModelsubmodules/univer/packages/sheets/src/facade/f-range.ts:36
_injectorreadonlyInjectorsubmodules/univer/packages/sheets/src/facade/f-range.ts:34
_rangereadonlyIRangesubmodules/univer/packages/sheets/src/facade/f-range.ts:33
_workbookreadonlyWorkbooksubmodules/univer/packages/sheets/src/facade/f-range.ts:31
_worksheetreadonlyWorksheetsubmodules/univer/packages/sheets/src/facade/f-range.ts:32

Methods

_initialize()

_initialize(): void

Returns

void

Inherited from

FBase._initialize

Defined in

submodules/univer/packages/core/src/facade/f-base.ts:33


breakApart()

breakApart(): FRange

Unmerge cells in the range

Returns

FRange

This range, for chaining

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:583


forEach()

forEach(callback): void

Iterate cells in this range. Merged cells will be respected.

Parameters

ParameterType
callback(row, col, cell) => void

Returns

void

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:594


getCellData()

getCellData(): null | ICellData

Return first cell model data in this range

Returns

null | ICellData

The cell model data

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:108


getCellDataGrid()

getCellDataGrid(): Nullable<ICellData>[][]

Returns the cell data for the cells in the range.

Returns

Nullable<ICellData>[][]

A two-dimensional array of cell data.

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:169


getCellStyleData()

getCellStyleData(): null | IStyleData

Return first cell style data in this range

Returns

null | IStyleData

The cell style data

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:126


getColumn()

getColumn(): number

Gets the starting column number of the applied area

Returns

number

The starting column number of the area

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:82


getFormulas()

getFormulas(): string[][]

Returns the formulas (A1 notation) for the cells in the range. Entries in the 2D array are empty strings for cells with no formula.

Returns

string[][]

A two-dimensional array of formulas in string format.

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:187


getHeight()

getHeight(): number

Gets the height of the applied area

Returns

number

The height of the area

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:100


getHorizontalAlignment()

getHorizontalAlignment(): string

Returns

string

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:216


getRange()

getRange(): IRange

Gets the area where the statement is applied

Returns

IRange

The area where the statement is applied

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:64


getRow()

getRow(): number

Gets the starting row number of the applied area

Returns

number

The starting row number of the area

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:73


getSheetName()

getSheetName(): string

Gets the name of the worksheet

Returns

string

The name of the worksheet

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:55


getUnitId()

getUnitId(): string

Get the unit ID of the current workbook

Returns

string

The unit ID of the workbook

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:46


getValue()

getValue(): null | CellValue

Returns the value of the cell at the start of this range.

Returns

null | CellValue

The value of the cell.

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:140


getValues()

getValues(): Nullable<CellValue>[][]

Returns the rectangular grid of values for this range. Returns a two-dimensional array of values, indexed by row, then by column.

Returns

Nullable<CellValue>[][]

A two-dimensional array of values.

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:149


getVerticalAlignment()

getVerticalAlignment(): string

Returns

string

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:220


getWidth()

getWidth(): number

Gets the width of the applied area

Returns

number

The width of the area

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:91


getWrap()

getWrap(): boolean

Returns

boolean

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:208


getWrapStrategy()

getWrapStrategy(): WrapStrategy

Returns

WrapStrategy

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:212


isMerged()

isMerged(): boolean

Return range whether this range is merged

Returns

boolean

if true is merged

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:116


isPartOfMerge()

isPartOfMerge(): boolean

Returns true if cells in the current range overlap a merged cell.

Returns

boolean

is overlap with a merged cell

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:574


merge()

merge(): Promise<FRange>

Merge cells in a range into one merged cell

Returns

Promise<FRange>

This range, for chaining

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:533


mergeAcross()

mergeAcross(): Promise<FRange>

Merges cells in a range horizontally.

Returns

Promise<FRange>

This range, for chaining

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:546


mergeVertically()

mergeVertically(): Promise<FRange>

Merges cells in a range vertically.

Returns

Promise<FRange>

This range, for chaining

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:560


setBackgroundColor()

setBackgroundColor(color): Promise<boolean>

Parameters

ParameterType
colorstring

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:226


setFontColor()

setFontColor(color): this

Sets the font color in CSS notation (such as ‘#ffffff’ or ‘white’).

Parameters

ParameterTypeDescription
colornull | stringThe font color in CSS notation (such as ‘#ffffff’ or ‘white’); a null value resets the color.

Returns

this

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:506


setFontFamily()

setFontFamily(fontFamily): this

Sets the font family, such as “Arial” or “Helvetica”.

Parameters

ParameterTypeDescription
fontFamilynull | stringThe font family to set; a null value resets the font family.

Returns

this

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:464


setFontLine()

setFontLine(fontLine): this

Sets the font line style of the given range (‘underline’, ‘line-through’, or ‘none’).

Parameters

ParameterTypeDescription
fontLinenull | FontLineThe font line style, either ‘underline’, ‘line-through’, or ‘none’; a null value resets the font line style.

Returns

this

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:399


setFontSize()

setFontSize(size): this

Sets the font size, with the size being the point size to use.

Parameters

ParameterTypeDescription
sizenull | numberA font size in point size. A null value resets the font size.

Returns

this

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:485


setFontStyle()

setFontStyle(fontStyle): this

Sets the font style for the given range (‘italic’ or ‘normal’).

Parameters

ParameterTypeDescription
fontStylenull | FontStyleThe font style, either ‘italic’ or ‘normal’; a null value resets the font style.

Returns

this

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:366


setFontWeight()

setFontWeight(fontWeight): this

Sets the font weight for the given range (normal/bold),

Parameters

ParameterTypeDescription
fontWeightnull | FontWeightThe font weight, either ‘normal’ or ‘bold’; a null value resets the font weight.

Returns

this

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:333


setHorizontalAlignment()

setHorizontalAlignment(alignment): Promise<boolean>

Set the horizontal (left to right) alignment for the given range (left/center/right).

Parameters

ParameterType
alignmentFHorizontalAlignment

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:299


setValue()

setValue(value): Promise<boolean>

The value can be a number, string, boolean, or standard cell format. If it begins with =, it is interpreted as a formula. The value is tiled to all cells in the range.

Parameters

ParameterType
valueICellData | CellValue

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:244


setValues()

setValues(value): Promise<boolean>

Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with =, it is interpreted as a formula.

Parameters

ParameterType
valueIObjectMatrixPrimitiveType<ICellData> | ICellData[][] | IObjectMatrixPrimitiveType<CellValue> | CellValue[][]

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:312


setVerticalAlignment()

setVerticalAlignment(alignment): Promise<boolean>

Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).

Parameters

ParameterType
alignmentFVerticalAlignment

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:287


setWrap()

setWrap(isWrapEnabled): Promise<boolean>

Set the cell wrap of the given range. Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.

Parameters

ParameterType
isWrapEnabledboolean

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:263


setWrapStrategy()

setWrapStrategy(strategy): Promise<boolean>

Sets the text wrapping strategy for the cells in the range.

Parameters

ParameterType
strategyWrapStrategy

Returns

Promise<boolean>

Defined in

submodules/univer/packages/sheets/src/facade/f-range.ts:275


extend()

static extend(source): void

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FBase.extend

Defined in

submodules/univer/packages/core/src/facade/f-base.ts:35