@univerjs/facade v0.1.17 • Docs
Class: FRange
Constructors
new FRange()
new FRange(
_workbook,
_worksheet,
_range,
_injector,
_commandService,
_renderManagerService,
_formulaDataModel): FRange
Parameters
Parameter | Type |
---|---|
_workbook | Workbook |
_worksheet | Worksheet |
_range | IRange |
_injector | Injector |
_commandService | ICommandService |
_renderManagerService | IRenderManagerService |
_formulaDataModel | FormulaDataModel |
Returns
Defined in
sheets/f-range.ts:65 (opens in a new tab)
Methods
forEach()
forEach(callback): void
Iterate cells in this range. Merged cells will be respected.
Parameters
Parameter | Type |
---|---|
callback | (row , col , cell ) => void |
Returns
void
Defined in
sheets/f-range.ts:514 (opens in a new tab)
generateHTML()
generateHTML(): string
Generate HTML content for the range.
Returns
string
Defined in
sheets/f-range.ts:527 (opens in a new tab)
getCell()
getCell(): ISelectionCellWithCoord
Return this cell information, including whether it is merged and cell coordinates
Returns
The cell information
Defined in
sheets/f-range.ts:105 (opens in a new tab)
getCellData()
getCellData(): null | ICellData
Return first cell model data in this range
Returns
null
| ICellData
The cell model data
Defined in
sheets/f-range.ts:97 (opens in a new tab)
getCellRect()
getCellRect(): DOMRect
Returns the coordinates of this cell,does not include units
Returns
DOMRect
coordinates of the cell, top, right, bottom, left
Defined in
sheets/f-range.ts:125 (opens in a new tab)
getCellStyleData()
getCellStyleData(): null | IStyleData
Return first cell style data in this range
Returns
null
| IStyleData
The cell style data
Defined in
sheets/f-range.ts:135 (opens in a new tab)
getColumn()
getColumn(): number
Returns
number
Defined in
sheets/f-range.ts:81 (opens in a new tab)
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
sheets/f-range.ts:153 (opens in a new tab)
getHeight()
getHeight(): number
Returns
number
Defined in
sheets/f-range.ts:89 (opens in a new tab)
getHorizontalAlignment()
getHorizontalAlignment(): string
Returns
string
Defined in
sheets/f-range.ts:182 (opens in a new tab)
getRow()
getRow(): number
Returns
number
Defined in
sheets/f-range.ts:77 (opens in a new tab)
getValue()
getValue(): null | CellValue
Returns
null
| CellValue
Defined in
sheets/f-range.ts:145 (opens in a new tab)
getVerticalAlignment()
getVerticalAlignment(): string
Returns
string
Defined in
sheets/f-range.ts:186 (opens in a new tab)
getWidth()
getWidth(): number
Returns
number
Defined in
sheets/f-range.ts:85 (opens in a new tab)
getWrap()
getWrap(): boolean
Returns
boolean
Defined in
sheets/f-range.ts:174 (opens in a new tab)
getWrapStrategy()
getWrapStrategy(): WrapStrategy
Returns
Defined in
sheets/f-range.ts:178 (opens in a new tab)
isMerged()
isMerged(): boolean
Return range whether this range is merged
Returns
boolean
if true is merged
Defined in
sheets/f-range.ts:117 (opens in a new tab)
setBackgroundColor()
setBackgroundColor(color): Promise<boolean>
Parameters
Parameter | Type |
---|---|
color | string |
Returns
Promise
<boolean
>
Defined in
sheets/f-range.ts:192 (opens in a new tab)
setFontColor()
setFontColor(color): this
Sets the font color in CSS notation (such as '#ffffff' or 'white').
Parameters
Parameter | Type | Description |
---|---|---|
color | null | string | The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color. |
Returns
this
Defined in
sheets/f-range.ts:489 (opens in a new tab)
setFontFamily()
setFontFamily(fontFamily): this
Sets the font family, such as "Arial" or "Helvetica".
Parameters
Parameter | Type | Description |
---|---|---|
fontFamily | null | string | The font family to set; a null value resets the font family. |
Returns
this
Defined in
sheets/f-range.ts:447 (opens in a new tab)
setFontLine()
setFontLine(fontLine): this
Sets the font line style of the given range ('underline', 'line-through', or 'none').
Parameters
Parameter | Type | Description |
---|---|---|
fontLine | null | FontLine | The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style. |
Returns
this
Defined in
sheets/f-range.ts:382 (opens in a new tab)
setFontSize()
setFontSize(size): this
Sets the font size, with the size being the point size to use.
Parameters
Parameter | Type | Description |
---|---|---|
size | null | number | A font size in point size. A null value resets the font size. |
Returns
this
Defined in
sheets/f-range.ts:468 (opens in a new tab)
setFontStyle()
setFontStyle(fontStyle): this
Sets the font style for the given range ('italic' or 'normal').
Parameters
Parameter | Type | Description |
---|---|---|
fontStyle | null | FontStyle | The font style, either 'italic' or 'normal'; a null value resets the font style. |
Returns
this
Defined in
sheets/f-range.ts:349 (opens in a new tab)
setFontWeight()
setFontWeight(fontWeight): this
Sets the font weight for the given range (normal/bold),
Parameters
Parameter | Type | Description |
---|---|---|
fontWeight | null | FontWeight | The font weight, either 'normal' or 'bold'; a null value resets the font weight. |
Returns
this
Defined in
sheets/f-range.ts:316 (opens in a new tab)
setHorizontalAlignment()
setHorizontalAlignment(alignment): Promise<boolean>
Set the horizontal (left to right) alignment for the given range (left/center/right).
Parameters
Parameter | Type |
---|---|
alignment | FHorizontalAlignment |
Returns
Promise
<boolean
>
Defined in
sheets/f-range.ts:265 (opens in a new tab)
setNumberFormat()
setNumberFormat(pattern): Promise<boolean>
Set the number format of the range.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | number format pattern. |
Returns
Promise
<boolean
>
Execution result.
Defined in
sheets/f-range.ts:279 (opens in a new tab)
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
Parameter | Type |
---|---|
value | ICellData | CellValue |
Returns
Promise
<boolean
>
Defined in
sheets/f-range.ts:210 (opens in a new tab)
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
Parameter | Type |
---|---|
value | IObjectMatrixPrimitiveType <ICellData > | ICellData [][] | IObjectMatrixPrimitiveType <CellValue > | CellValue [][] |
Returns
Promise
<boolean
>
Defined in
sheets/f-range.ts:295 (opens in a new tab)
setVerticalAlignment()
setVerticalAlignment(alignment): Promise<boolean>
Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
Parameters
Parameter | Type |
---|---|
alignment | FVerticalAlignment |
Returns
Promise
<boolean
>
Defined in
sheets/f-range.ts:253 (opens in a new tab)
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
Parameter | Type |
---|---|
isWrapEnabled | boolean |
Returns
Promise
<boolean
>
Defined in
sheets/f-range.ts:229 (opens in a new tab)
setWrapStrategy()
setWrapStrategy(strategy): Promise<boolean>
Sets the text wrapping strategy for the cells in the range.
Parameters
Parameter | Type |
---|---|
strategy | WrapStrategy |
Returns
Promise
<boolean
>