@univerjs/facade v0.4.2 • 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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:101 (opens in a new tab)
Methods
addComment()
addComment(content): Promise<boolean>
Add a comment to the start cell in the current range.
Parameters
Parameter | Type | Description |
---|---|---|
content | IDocumentBody | The content of the comment. |
Returns
Promise
<boolean
>
Whether the comment is added successfully.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:867 (opens in a new tab)
attachAlertPopup()
attachAlertPopup(alert): IDisposable
Attach an alert popup to the start cell of current range.
Parameters
Parameter | Type | Description |
---|---|---|
alert | Omit <ICellAlert , "location" > | The alert to attach |
Returns
The disposable object to detach the alert.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:818 (opens in a new tab)
attachPopup()
attachPopup(popup): Nullable<IDisposable>
Attach a popup to the start cell of current range. If current worksheet is not active, the popup will not be shown. Be careful to manager the detach disposable object, if not dispose correctly, it might memory leaks.
Parameters
Parameter | Type | Description |
---|---|---|
popup | IFCanvasPopup | The popup to attach |
Returns
The disposable object to detach the popup, if the popup is not attached, return null
.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:794 (opens in a new tab)
breakApart()
breakApart(): FRange
Unmerge cells in the range
Returns
This range, for chaining
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:974 (opens in a new tab)
cancelHyperLink()
cancelHyperLink(id): Promise<boolean>
Cancel hyperlink in the cell in the range.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | id of the hyperlink |
Returns
Promise
<boolean
>
success or not
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:1052 (opens in a new tab)
clearComment()
clearComment(): Promise<boolean>
Clear the comment of the start cell in the current range.
Returns
Promise
<boolean
>
Whether the comment is cleared successfully.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:899 (opens in a new tab)
createFilter()
createFilter(): Promise<null | FFilter>
Create a filter for the current range. If the worksheet already has a filter, this method would return null
.
Returns
Promise
<null
| FFilter
>
The interface class to handle the filter. If the worksheet already has a filter,
this method would return null
.
Async
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:751 (opens in a new tab)
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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:641 (opens in a new tab)
generateHTML()
generateHTML(): string
Generate HTML content for the range.
Returns
string
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:654 (opens in a new tab)
getCell()
getCell(): ISelectionCellWithMergeInfo
Return this cell information, including whether it is merged and cell coordinates
Returns
The cell information
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:188 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:180 (opens in a new tab)
getCellDataGrid()
getCellDataGrid(): Nullable<ICellData>[][]
Returns the cell data for the cells in the range.
Returns
A two-dimensional array of cell data.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:262 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:209 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:219 (opens in a new tab)
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/facade/src/apis/sheets/f-range.ts:154 (opens in a new tab)
getComment()
getComment(): Nullable<FThreadComment>
Get the comment of the start cell in the current range.
Returns
The comment of the start cell in the current range. If the cell does not have a comment, return null
.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:844 (opens in a new tab)
getDataValidation()
getDataValidation(): Nullable<FDataValidation>
get first data validation rule in current range
Returns
data validation rule
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:698 (opens in a new tab)
getDataValidations()
getDataValidations(): FDataValidation[]
get all data validation rules in current range
Returns
all data validation rules
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:717 (opens in a new tab)
getFilter()
getFilter(): null | FFilter
Get the filter for the current range's worksheet.
Returns
null
| FFilter
The interface class to handle the filter. If the worksheet does not have a filter,
this method would return null
.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:771 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:280 (opens in a new tab)
getHeight()
getHeight(): number
Gets the height of the applied area
Returns
number
The height of the area
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:172 (opens in a new tab)
getHorizontalAlignment()
getHorizontalAlignment(): string
Returns
string
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:309 (opens in a new tab)
getHyperLinks()
getHyperLinks(): ICellHyperLink[]
Get all hyperlinks in the cell in the range.
Returns
ICellHyperLink
[]
hyperlinks
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:1007 (opens in a new tab)
getRange()
getRange(): IRange
Gets the area where the statement is applied
Returns
The area where the statement is applied
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:136 (opens in a new tab)
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/facade/src/apis/sheets/f-range.ts:145 (opens in a new tab)
getSheetName()
getSheetName(): string
Gets the name of the worksheet
Returns
string
The name of the worksheet
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:127 (opens in a new tab)
getUnitId()
getUnitId(): string
Get the unit ID of the current workbook
Returns
string
The unit ID of the workbook
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:118 (opens in a new tab)
getValidatorStatus()
getValidatorStatus(): Promise<Promise<DataValidationStatus>[][]>
get data validation validator status for current range
Returns
Promise
<Promise
<DataValidationStatus
>[][]>
matrix of validator status
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:730 (opens in a new tab)
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/facade/src/apis/sheets/f-range.ts:233 (opens in a new tab)
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
A two-dimensional array of values.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:242 (opens in a new tab)
getVerticalAlignment()
getVerticalAlignment(): string
Returns
string
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:313 (opens in a new tab)
getWidth()
getWidth(): number
Gets the width of the applied area
Returns
number
The width of the area
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:163 (opens in a new tab)
getWrap()
getWrap(): boolean
Returns
boolean
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:301 (opens in a new tab)
getWrapStrategy()
getWrapStrategy(): WrapStrategy
Returns
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:305 (opens in a new tab)
isMerged()
isMerged(): boolean
Return range whether this range is merged
Returns
boolean
if true is merged
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:201 (opens in a new tab)
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/facade/src/apis/sheets/f-range.ts:965 (opens in a new tab)
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/facade/src/apis/sheets/f-range.ts:924 (opens in a new tab)
mergeAcross()
mergeAcross(): Promise<FRange>
Merges cells in a range horizontally.
Returns
Promise
<FRange
>
This range, for chaining
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:937 (opens in a new tab)
mergeVertically()
mergeVertically(): Promise<FRange>
Merges cells in a range vertically.
Returns
Promise
<FRange
>
This range, for chaining
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:951 (opens in a new tab)
setBackgroundColor()
setBackgroundColor(color): Promise<boolean>
Parameters
Parameter | Type |
---|---|
color | string |
Returns
Promise
<boolean
>
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:319 (opens in a new tab)
setDataValidation()
setDataValidation(rule): this
set a data validation rule to current range
Parameters
Parameter | Type | Description |
---|---|---|
rule | Nullable <FDataValidation > | data validation rule, build by FUniver.newDataValidation |
Returns
this
current range
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:671 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:616 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:574 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:509 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:595 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:476 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:443 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:392 (opens in a new tab)
setHyperLink()
setHyperLink(url, label?): Promise<boolean>
Set a hyperlink to the cell in the range.
Parameters
Parameter | Type | Description |
---|---|---|
url | string | url |
label ? | string | optional, label of the url |
Returns
Promise
<boolean
>
success or not
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:987 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:406 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:337 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:422 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:380 (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
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:356 (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
>
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:368 (opens in a new tab)
updateHyperLink()
updateHyperLink(
id,
url,
label?): Promise<boolean>
Update hyperlink in the cell in the range.
Parameters
Parameter | Type | Description |
---|---|---|
id | string | id of the hyperlink |
url | string | url |
label ? | string | optional, label of the url |
Returns
Promise
<boolean
>
success or not
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-range.ts:1031 (opens in a new tab)