@univerjs/sheets v0.5.4


Class: FRange

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

Extends

Extended by

Constructors

new FRange()

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

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:31

Parameters

ParameterType
_workbookWorkbook
_worksheetWorksheet
_rangeIRange
_injectorInjector
_commandServiceICommandService
_formulaDataModelFormulaDataModel

Returns

FRange

Overrides

FBaseInitialable.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefined-submodules/univer/packages/sheets/src/facade/f-range.ts:36
_disposedprotectedbooleanfalseFBaseInitialable._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
_formulaDataModelreadonlyFormulaDataModelundefined-submodules/univer/packages/sheets/src/facade/f-range.ts:37
_injectorreadonlyInjectorundefinedFBaseInitialable._injectorsubmodules/univer/packages/sheets/src/facade/f-range.ts:35
_rangereadonlyIRangeundefined-submodules/univer/packages/sheets/src/facade/f-range.ts:34
_workbookreadonlyWorkbookundefined-submodules/univer/packages/sheets/src/facade/f-range.ts:32
_worksheetreadonlyWorksheetundefined-submodules/univer/packages/sheets/src/facade/f-range.ts:33

Methods

_initialize()

_initialize(injector): void

Defined in: submodules/univer/packages/core/src/facade/f-base.ts:66

Parameters

ParameterType
injectorInjector

Returns

void

Inherited from

FBaseInitialable._initialize


activate()

activate(): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:986

Sets the specified range as the active range, with the top left cell in the range as the current cell.

Returns

FRange

This range, for chaining.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
const fRange = fWorksheet.getRange('A1:B2');
fRange.activate(); // the active cell will be A1

activateAsCurrentCell()

activateAsCurrentCell(): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:999

Sets the specified cell as the current cell. If the specified cell is present in an existing range, then that range becomes the active range with the cell as the current cell. If the specified cell is not part of an existing range, then a new range is created with the cell as the active range and the current cell.

Returns

FRange

This range, for chaining.

Description

If the range is not a single cell, an error will be thrown.


breakApart()

breakApart(): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:928

Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.

Returns

FRange

This range, for chaining

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
const range = worksheet.getRange(0,0,2,2);
const merge = range.merge();
const anchor = worksheet.getRange(0,0);
const isPartOfMergeFirst = anchor.isPartOfMerge();
console.log('debugger' isPartOfMergeFirst) // true
range.breakApart();
const isPartOfMergeSecond = anchor.isPartOfMerge();
console.log('debugger' isPartOfMergeSecond) // false

dispose()

dispose(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FBaseInitialable.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FBaseInitialable.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FBaseInitialable.ensureNotDisposed


forEach()

forEach(callback): void

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:950

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

Parameters

ParameterTypeDescription
callback(row, col, cell) => voidthe callback function to be called for each cell in the range

Returns

void


getA1Notation()

getA1Notation(withSheet?): string

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:971

Returns a string description of the range, in A1 notation.

Parameters

ParameterType
withSheet?boolean

Returns

string

The A1 notation of the range.

const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
const fRange = fWorksheet.getRange('A1:B2');
console.log(fRange.getA1Notation()); // A1:B2

getCellData()

getCellData(): null | ICellData

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:170

Return first cell model data in this range

Returns

null | ICellData

The cell model data

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getCellData()

getCellDataGrid()

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

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:202

Returns

Nullable<ICellData>[][]

Deprecated

use getCellDatas instead.


getCellDatas()

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

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:185

Returns the cell data for the cells in the range.

Returns

Nullable<ICellData>[][]

A two-dimensional array of cell data.

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getCellDatas()

getCellStyleData()

getCellStyleData(): null | IStyleData

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:120

Return first cell style data in this range

Returns

null | IStyleData

The cell style data


getColumn()

getColumn(): number

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:86

Gets the starting column number of the applied area

Returns

number

The starting column number of the area


getCustomMetaData()

getCustomMetaData(): CustomData

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:364

Returns the custom meta data for the cell at the start of this range.

Returns

CustomData

The custom meta data

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getCustomMetaData()

getCustomMetaDatas()

getCustomMetaDatas(): Nullable<CustomData>[][]

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:380

Returns the custom meta data for the cells in the range.

Returns

Nullable<CustomData>[][]

A two-dimensional array of custom meta data

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getCustomMetaDatas()

getFormulas()

getFormulas(): string[][]

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:284

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.

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getFormulas()

getHeight()

getHeight(): number

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:102

Gets the height of the applied area

Returns

number

The height of the area


getHorizontalAlignment()

getHorizontalAlignment(): string

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:313

Returns

string


getRange()

getRange(): IRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:70

Gets the area where the statement is applied

Returns

IRange

The area where the statement is applied


getRichTextValue()

getRichTextValue(): Nullable<RichTextValue>

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:217

Returns the rich text value for the cell at the start of this range.

Returns

Nullable<RichTextValue>

The rich text value

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getRichTextValue()

getRichTextValues()

getRichTextValues(): Nullable<RichTextValue>[][]

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:236

Returns the rich text value for the cells in the range.

Returns

Nullable<RichTextValue>[][]

A two-dimensional array of RichTextValue objects.

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getRichTextValues()

getRow()

getRow(): number

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:78

Gets the starting row number of the applied area

Returns

number

The starting row number of the area


getSheetId()

getSheetId(): string

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:62

Gets the ID of the worksheet

Returns

string

The ID of the worksheet


getSheetName()

getSheetName(): string

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:54

Gets the name of the worksheet

Returns

string

The name of the worksheet


getUnitId()

getUnitId(): string

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

Get the unit ID of the current workbook

Returns

string

The unit ID of the workbook


getUsedThemeStyle()

getUsedThemeStyle(): undefined | string

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:1140

Gets the theme style applied to the range.

Returns

undefined | string

The name of the theme style applied to the range or not exist.

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
const fRange = fWorksheet.getRange('A1:E20');
fRange.useThemeStyle('default');
const themeStyle = fRange.getUsedThemeStyle();
console.log(themeStyle); // 'default'

getValue()

getValue(): null | CellValue

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:134

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

Returns

null | CellValue

The value of the cell.


getValueAndRichTextValue()

getValueAndRichTextValue(): Nullable<
  | CellValue
| RichTextValue>

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:252

Returns the value and rich text value for the cell at the start of this range.

Returns

Nullable< | CellValue | RichTextValue>

The value and rich text value

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getValueAndRichTextValue()

getValueAndRichTextValues()

getValueAndRichTextValues(): Nullable<
  | CellValue
  | RichTextValue>[][]

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:268

Returns the value and rich text value for the cells in the range.

Returns

Nullable< | CellValue | RichTextValue>[][]

A two-dimensional array of value and rich text value

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .getValueAndRichTextValues()

getValues()

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

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:143

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.


getVerticalAlignment()

getVerticalAlignment(): string

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:317

Returns

string


getWidth()

getWidth(): number

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:94

Gets the width of the applied area

Returns

number

The width of the area


getWrap()

getWrap(): boolean

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:305

Returns

boolean


getWrapStrategy()

getWrapStrategy(): WrapStrategy

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:309

Returns

WrapStrategy


isMerged()

isMerged(): boolean

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:110

Return range whether this range is merged

Returns

boolean

if true is merged


isPartOfMerge()

isPartOfMerge(): boolean

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:906

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

Returns

boolean

is overlap with a merged cell

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
const range = worksheet.getRange(0,0,2,2);
const merge = range.merge();
const anchor = worksheet.getRange(0,0);
const isPartOfMerge = anchor.isPartOfMerge();
console.log('debugger, isPartOfMerge) // true

merge()

merge(defaultMerge?): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:835

Merge cells in a range into one merged cell

Parameters

ParameterTypeDefault valueDescription
defaultMerge?booleantrueIf true, only the value in the upper left cell is retained.

Returns

FRange

This range, for chaining

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
const range = worksheet.getRange(0, 0, 2, 2);
const merge = range.merge();
const isMerged = merge.isMerged();
console.log('debugger', isMerged);

mergeAcross()

mergeAcross(defaultMerge?): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:858

Merges cells in a range horizontally.

Parameters

ParameterTypeDefault valueDescription
defaultMerge?booleantrueIf true, only the value in the upper left cell is retained.

Returns

FRange

This range, for chaining

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
const range = worksheet.getRange(2, 2, 2, 2);
const merge = range.mergeAcross();
const allMerge = worksheet.getMergeData();
console.log(allMerge.length); // There will be two merged cells.

mergeVertically()

mergeVertically(defaultMerge?): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:882

Merges cells in a range vertically.

Parameters

ParameterTypeDefault valueDescription
defaultMerge?booleantrueIf true, only the value in the upper left cell is retained.

Returns

FRange

This range, for chaining

Example

const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
const range = worksheet.getRange(4, 4, 2, 2);
const merge = range.mergeVertically();
const allMerge = worksheet.getMergeData();
console.log(allMerge.length); // There will be two merged cells.

removeThemeStyle()

removeThemeStyle(themeName): void

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:1118

Remove the theme style for the range.

Parameters

ParameterTypeDescription
themeNamestringThe name of the theme style to remove.

Returns

void

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
const fRange = fWorksheet.getRange('A1:E20');
fRange.removeThemeStyle('default');

setBackground()

setBackground(color): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:421

Set background color for current range.

Parameters

ParameterTypeDescription
colorstring{string}

Returns

FRange

Example

univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')

setBackgroundColor()

setBackgroundColor(color): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:398

Set background color for current range.

Parameters

ParameterTypeDescription
colorstring{string}

Returns

FRange

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .setBackgroundColor('red')

setCustomMetaData()

setCustomMetaData(data): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:332

Set custom meta data for first cell in current range.

Parameters

ParameterTypeDescription
dataCustomDataThe custom meta data

Returns

FRange

This range, for chaining

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .setCustomMetaData({ key: 'value' });

setCustomMetaDatas()

setCustomMetaDatas(datas): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:349

Set custom meta data for current range.

Parameters

ParameterTypeDescription
datasCustomData[][]The custom meta data

Returns

FRange

This range, for chaining

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .setCustomMetaDatas([[{ key: 'value' }]]);

setFontColor()

setFontColor(color): this

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:798

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


setFontFamily()

setFontFamily(fontFamily): this

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:756

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


setFontLine()

setFontLine(fontLine): this

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:689

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


setFontSize()

setFontSize(size): this

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:777

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


setFontStyle()

setFontStyle(fontStyle): this

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:656

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


setFontWeight()

setFontWeight(fontWeight): this

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:623

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


setHorizontalAlignment()

setHorizontalAlignment(alignment): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:585

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

Parameters

ParameterType
alignmentFHorizontalAlignment

Returns

FRange


setRichTextValueForCell()

setRichTextValueForCell(value): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:491

Set the rich text value for the cell at the start of this range.

Parameters

ParameterTypeDescription
value| IDocumentData | RichTextValueThe rich text value

Returns

FRange

The range

Example

univerAPI.getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .setRichTextValueForCell(new RichTextValue().insertText('Hello'));

setRichTextValues()

setRichTextValues(values): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:521

Set the rich text value for the cells in the range.

Parameters

ParameterTypeDescription
values( | IDocumentData | RichTextValue)[][]The rich text value

Returns

FRange

The range

Example

univerAPI
 .getActiveWorkbook()
 .getActiveSheet()
 .getActiveRange()
 .setRichTextValues([[new RichTextValue().insertText('Hello')]]);

setValue()

setValue(value): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:430

Set new value for current cell, first cell in this range.

Parameters

ParameterTypeDescription
value| ICellData | CellValueThe 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.

Returns

FRange


setValueForCell()

setValueForCell(value): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:457

Set new value for current cell, first cell in this range.

Parameters

ParameterTypeDescription
value| ICellData | CellValueThe 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. univerAPI.getActiveWorkbook() .getActiveSheet() .getActiveRange() .setValueForCell(1);

Returns

FRange


setValues()

setValues(value): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:600

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
value| IObjectMatrixPrimitiveType<ICellData> | ICellData[][] | IObjectMatrixPrimitiveType<CellValue> | CellValue[][]

Returns

FRange


setVerticalAlignment()

setVerticalAlignment(alignment): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:570

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

Parameters

ParameterType
alignmentFVerticalAlignment

Returns

FRange


setWrap()

setWrap(isWrapEnabled): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:540

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

FRange


setWrapStrategy()

setWrapStrategy(strategy): FRange

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:555

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

Parameters

ParameterType
strategyWrapStrategy

Returns

FRange


splitTextToColumns()

Splits a column of text into multiple columns based on a custom specified delimiter.

Param

Whether to treat multiple continuous delimiters as one. The default value is false.

Param

The delimiter to use to split the text. The default delimiter is Tab(1)、Comma(2)、Semicolon(4)、Space(8)、Custom(16).A delimiter like 6 (SplitDelimiterEnum.Comma|SplitDelimiterEnum.Semicolon) means using Comma and Semicolon to split the text.

Param

The custom delimiter to split the text. An error will be thrown if custom delimiter is set but the customDelimiter is not a character.

Examples

Show how to split text to columns with combined delimiter. The bit operations are used to combine the delimiters.
// A1:A3 has following values:
//     A   | B | C
//  1;;2;3 |   |
//  1;,2;3 |   |
// After calling splitTextToColumns(false, SplitDelimiterEnum.Semicolon|SplitDelimiterEnum.Comma), the range will be:
//  A | B | C | D
//  1 |   | 2 | 3
//  1 |   | 2 | 3
// After calling splitTextToColumns(true, SplitDelimiterEnum.Semicolon|SplitDelimiterEnum.Comma), the range will be:
//  A | B | C
//  1 | 2 | 3
//  1 | 2 | 3
Show how to split text to columns with custom delimiter
// A1:A3 has following values:
//     A   | B | C
//  1#2#3  |   |
//  4##5#6 |   |
// After calling splitTextToColumns(false, SplitDelimiterEnum.Custom, '#'), the range will be:
//  A | B | C | D
//  1 | 2 | 3 |
//  4 |   | 5 | 6
// After calling splitTextToColumns(true, SplitDelimiterEnum.Custom, '#'), the range will be:
//  A | B | C
//  1 | 2 | 3
//  4 | 5 | 6

Call Signature

splitTextToColumns(treatMultipleDelimitersAsOne?): void

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:1029

Splits a column of text into multiple columns based on an auto-detected delimiter.

Parameters
ParameterTypeDescription
treatMultipleDelimitersAsOne?booleanWhether to treat multiple continuous delimiters as one. The default value is false.
Returns

void

Param

Whether to treat multiple continuous delimiters as one. The default value is false.

Param

The delimiter to use to split the text. The default delimiter is Tab(1)、Comma(2)、Semicolon(4)、Space(8)、Custom(16).A delimiter like 6 (SplitDelimiterEnum.Comma|SplitDelimiterEnum.Semicolon) means using Comma and Semicolon to split the text.

Param

The custom delimiter to split the text. An error will be thrown if custom delimiter is set but the customDelimiter is not a character.

Examples
Show how to split text to columns with combined delimiter. The bit operations are used to combine the delimiters.
// A1:A3 has following values:
//     A   | B | C
//  1;;2;3 |   |
//  1;,2;3 |   |
// After calling splitTextToColumns(false, SplitDelimiterEnum.Semicolon|SplitDelimiterEnum.Comma), the range will be:
//  A | B | C | D
//  1 |   | 2 | 3
//  1 |   | 2 | 3
// After calling splitTextToColumns(true, SplitDelimiterEnum.Semicolon|SplitDelimiterEnum.Comma), the range will be:
//  A | B | C
//  1 | 2 | 3
//  1 | 2 | 3
Show how to split text to columns with custom delimiter
// A1:A3 has following values:
//     A   | B | C
//  1#2#3  |   |
//  4##5#6 |   |
// After calling splitTextToColumns(false, SplitDelimiterEnum.Custom, '#'), the range will be:
//  A | B | C | D
//  1 | 2 | 3 |
//  4 |   | 5 | 6
// After calling splitTextToColumns(true, SplitDelimiterEnum.Custom, '#'), the range will be:
//  A | B | C
//  1 | 2 | 3
//  4 | 5 | 6
// A1:A3 has following values:
//     A  | B | C
//  1,2,3 |   |
//  4,,5,6 |   |
// After calling splitTextToColumns(true), the range will be:
//  A | B | C
//  1 | 2 | 3
//  4 | 5 | 6
// After calling splitTextToColumns(false), the range will be:
//  A | B | C | D
//  1 | 2 | 3 |
//  4 |   | 5 | 6

Call Signature

splitTextToColumns(treatMultipleDelimitersAsOne?, delimiter?): void

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:1036

Splits a column of text into multiple columns based on a specified delimiter.

Parameters
ParameterTypeDescription
treatMultipleDelimitersAsOne?booleanWhether to treat multiple continuous delimiters as one. The default value is false.
delimiter?SplitDelimiterEnumThe delimiter to use to split the text. The default delimiter is Tab(1)、Comma(2)、Semicolon(4)、Space(8)、Custom(16).A delimiter like 6 (SplitDelimiterEnum.Comma
Returns

void

Param

Whether to treat multiple continuous delimiters as one. The default value is false.

Param

The delimiter to use to split the text. The default delimiter is Tab(1)、Comma(2)、Semicolon(4)、Space(8)、Custom(16).A delimiter like 6 (SplitDelimiterEnum.Comma|SplitDelimiterEnum.Semicolon) means using Comma and Semicolon to split the text.

Param

The custom delimiter to split the text. An error will be thrown if custom delimiter is set but the customDelimiter is not a character.

Examples
Show how to split text to columns with combined delimiter. The bit operations are used to combine the delimiters.
// A1:A3 has following values:
//     A   | B | C
//  1;;2;3 |   |
//  1;,2;3 |   |
// After calling splitTextToColumns(false, SplitDelimiterEnum.Semicolon|SplitDelimiterEnum.Comma), the range will be:
//  A | B | C | D
//  1 |   | 2 | 3
//  1 |   | 2 | 3
// After calling splitTextToColumns(true, SplitDelimiterEnum.Semicolon|SplitDelimiterEnum.Comma), the range will be:
//  A | B | C
//  1 | 2 | 3
//  1 | 2 | 3
Show how to split text to columns with custom delimiter
// A1:A3 has following values:
//     A   | B | C
//  1#2#3  |   |
//  4##5#6 |   |
// After calling splitTextToColumns(false, SplitDelimiterEnum.Custom, '#'), the range will be:
//  A | B | C | D
//  1 | 2 | 3 |
//  4 |   | 5 | 6
// After calling splitTextToColumns(true, SplitDelimiterEnum.Custom, '#'), the range will be:
//  A | B | C
//  1 | 2 | 3
//  4 | 5 | 6

useThemeStyle()

useThemeStyle(themeName): void

Defined in: submodules/univer/packages/sheets/src/facade/f-range.ts:1091

Set the theme style for the range.

Parameters

ParameterTypeDescription
themeNameundefined | stringThe name of the theme style to apply.If a undefined value is passed, the theme style will be removed if it exist.

Returns

void

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
const fRange = fWorksheet.getRange('A1:E20');
fRange.useThemeStyle('default');

extend()

static extend(source): void

Defined in: submodules/univer/packages/core/src/facade/f-base.ts:68

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FBaseInitialable.extend