@univerjs/sheets-sort v0.5.4


Class: FRangeSort

Defined in: sheets-sort/src/facade/f-range.ts:41

Extends

Implements

Constructors

new FRangeSort()

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

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

Parameters

ParameterType
_workbookWorkbook
_worksheetWorksheet
_rangeIRange
_injectorInjector
_commandServiceICommandService
_formulaDataModelFormulaDataModel

Returns

FRangeSort

Inherited from

FRange.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefinedFRange._commandServicesheets/src/facade/f-range.ts:36
_disposedprotectedbooleanfalseFRange._disposedcore/src/shared/lifecycle.ts:96
_formulaDataModelreadonlyFormulaDataModelundefinedFRange._formulaDataModelsheets/src/facade/f-range.ts:37
_injectorreadonlyInjectorundefinedFRange._injectorsheets/src/facade/f-range.ts:35
_rangereadonlyIRangeundefinedFRange._rangesheets/src/facade/f-range.ts:34
_workbookreadonlyWorkbookundefinedFRange._workbooksheets/src/facade/f-range.ts:32
_worksheetreadonlyWorksheetundefinedFRange._worksheetsheets/src/facade/f-range.ts:33

Methods

_initialize()

_initialize(injector): void

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

Parameters

ParameterType
injectorInjector

Returns

void

Inherited from

FRange._initialize


activate()

activate(): FRange

Defined in: 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

Inherited from

FRange.activate


activateAsCurrentCell()

activateAsCurrentCell(): FRange

Defined in: 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.

Inherited from

FRange.activateAsCurrentCell


breakApart()

breakApart(): FRange

Defined in: 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

Inherited from

FRange.breakApart


dispose()

dispose(): void

Defined in: core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FRange.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FRange.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FRange.ensureNotDisposed


forEach()

forEach(callback): void

Defined in: 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

Inherited from

FRange.forEach


getA1Notation()

getA1Notation(withSheet?): string

Defined in: 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

Inherited from

FRange.getA1Notation


getCellData()

getCellData(): null | ICellData

Defined in: 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()

Inherited from

FRange.getCellData


getCellDataGrid()

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

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

Returns

Nullable<ICellData>[][]

Deprecated

use getCellDatas instead.

Inherited from

FRange.getCellDataGrid


getCellDatas()

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

Defined in: 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()

Inherited from

FRange.getCellDatas


getCellStyleData()

getCellStyleData(): null | IStyleData

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

Return first cell style data in this range

Returns

null | IStyleData

The cell style data

Inherited from

FRange.getCellStyleData


getColumn()

getColumn(): number

Defined in: 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

Inherited from

FRange.getColumn


getCustomMetaData()

getCustomMetaData(): CustomData

Defined in: 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()

Inherited from

FRange.getCustomMetaData


getCustomMetaDatas()

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

Defined in: 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()

Inherited from

FRange.getCustomMetaDatas


getFormulas()

getFormulas(): string[][]

Defined in: 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()

Inherited from

FRange.getFormulas


getHeight()

getHeight(): number

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

Gets the height of the applied area

Returns

number

The height of the area

Inherited from

FRange.getHeight


getHorizontalAlignment()

getHorizontalAlignment(): string

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

Returns

string

Inherited from

FRange.getHorizontalAlignment


getRange()

getRange(): IRange

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

Gets the area where the statement is applied

Returns

IRange

The area where the statement is applied

Inherited from

FRange.getRange


getRichTextValue()

getRichTextValue(): Nullable<RichTextValue>

Defined in: 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()

Inherited from

FRange.getRichTextValue


getRichTextValues()

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

Defined in: 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()

Inherited from

FRange.getRichTextValues


getRow()

getRow(): number

Defined in: 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

Inherited from

FRange.getRow


getSheetId()

getSheetId(): string

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

Gets the ID of the worksheet

Returns

string

The ID of the worksheet

Inherited from

FRange.getSheetId


getSheetName()

getSheetName(): string

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

Gets the name of the worksheet

Returns

string

The name of the worksheet

Inherited from

FRange.getSheetName


getUnitId()

getUnitId(): string

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

Get the unit ID of the current workbook

Returns

string

The unit ID of the workbook

Inherited from

FRange.getUnitId


getUsedThemeStyle()

getUsedThemeStyle(): undefined | string

Defined in: 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'

Inherited from

FRange.getUsedThemeStyle


getValue()

getValue(): null | CellValue

Defined in: 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.

Inherited from

FRange.getValue


getValueAndRichTextValue()

getValueAndRichTextValue(): Nullable<
  | CellValue
| RichTextValue>

Defined in: 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()

Inherited from

FRange.getValueAndRichTextValue


getValueAndRichTextValues()

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

Defined in: 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()

Inherited from

FRange.getValueAndRichTextValues


getValues()

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

Defined in: 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.

Inherited from

FRange.getValues


getVerticalAlignment()

getVerticalAlignment(): string

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

Returns

string

Inherited from

FRange.getVerticalAlignment


getWidth()

getWidth(): number

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

Gets the width of the applied area

Returns

number

The width of the area

Inherited from

FRange.getWidth


getWrap()

getWrap(): boolean

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

Returns

boolean

Inherited from

FRange.getWrap


getWrapStrategy()

getWrapStrategy(): WrapStrategy

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

Returns

WrapStrategy

Inherited from

FRange.getWrapStrategy


isMerged()

isMerged(): boolean

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

Return range whether this range is merged

Returns

boolean

if true is merged

Inherited from

FRange.isMerged


isPartOfMerge()

isPartOfMerge(): boolean

Defined in: 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

Inherited from

FRange.isPartOfMerge


merge()

merge(defaultMerge?): FRange

Defined in: 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);

Inherited from

FRange.merge


mergeAcross()

mergeAcross(defaultMerge?): FRange

Defined in: 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.

Inherited from

FRange.mergeAcross


mergeVertically()

mergeVertically(defaultMerge?): FRange

Defined in: 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.

Inherited from

FRange.mergeVertically


removeThemeStyle()

removeThemeStyle(themeName): void

Defined in: 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');

Inherited from

FRange.removeThemeStyle


setBackground()

setBackground(color): FRange

Defined in: 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')

Inherited from

FRange.setBackground


setBackgroundColor()

setBackgroundColor(color): FRange

Defined in: 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')

Inherited from

FRange.setBackgroundColor


setCustomMetaData()

setCustomMetaData(data): FRange

Defined in: 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' });

Inherited from

FRange.setCustomMetaData


setCustomMetaDatas()

setCustomMetaDatas(datas): FRange

Defined in: 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' }]]);

Inherited from

FRange.setCustomMetaDatas


setFontColor()

setFontColor(color): this

Defined in: 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

Inherited from

FRange.setFontColor


setFontFamily()

setFontFamily(fontFamily): this

Defined in: 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

Inherited from

FRange.setFontFamily


setFontLine()

setFontLine(fontLine): this

Defined in: 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

Inherited from

FRange.setFontLine


setFontSize()

setFontSize(size): this

Defined in: 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

Inherited from

FRange.setFontSize


setFontStyle()

setFontStyle(fontStyle): this

Defined in: 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

Inherited from

FRange.setFontStyle


setFontWeight()

setFontWeight(fontWeight): this

Defined in: 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

Inherited from

FRange.setFontWeight


setHorizontalAlignment()

setHorizontalAlignment(alignment): FRange

Defined in: 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

Inherited from

FRange.setHorizontalAlignment


setRichTextValueForCell()

setRichTextValueForCell(value): FRange

Defined in: 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'));

Inherited from

FRange.setRichTextValueForCell


setRichTextValues()

setRichTextValues(values): FRange

Defined in: 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')]]);

Inherited from

FRange.setRichTextValues


setValue()

setValue(value): FRange

Defined in: 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

Inherited from

FRange.setValue


setValueForCell()

setValueForCell(value): FRange

Defined in: 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

Inherited from

FRange.setValueForCell


setValues()

setValues(value): FRange

Defined in: 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

Inherited from

FRange.setValues


setVerticalAlignment()

setVerticalAlignment(alignment): FRange

Defined in: 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

Inherited from

FRange.setVerticalAlignment


setWrap()

setWrap(isWrapEnabled): FRange

Defined in: 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

Inherited from

FRange.setWrap


setWrapStrategy()

setWrapStrategy(strategy): FRange

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

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

Parameters

ParameterType
strategyWrapStrategy

Returns

FRange

Inherited from

FRange.setWrapStrategy


sort()

sort(column): FRange

Defined in: sheets-sort/src/facade/f-range.ts:42

Sorts the cells in the given range, by column(s) and order specified.

Parameters

ParameterTypeDescription
column| SortColumnSpec | SortColumnSpec[]The column index with order or an array of column indexes with order. The column index starts from 1.

Returns

FRange

The range itself for chaining.

Example

const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const range = activeSheet.getRange(0, 0, 10, 10);
range.sort(1); // Sorts the range by the first column in ascending order.
range.sort({ column: 1, ascending: false }); // Sorts the range by the first column in descending order.
range.sort([{ column: 1, ascending: false }, 2]); // Sorts the range by the first column in descending order and the second column in ascending order.

Implementation of

IFRangeSort.sort

Overrides

FRange.sort

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: 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
Inherited from

FRange.splitTextToColumns

Call Signature

splitTextToColumns(treatMultipleDelimitersAsOne?, delimiter?): void

Defined in: 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
Inherited from

FRange.splitTextToColumns


useThemeStyle()

useThemeStyle(themeName): void

Defined in: 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');

Inherited from

FRange.useThemeStyle


extend()

static extend(source): void

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

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FRange.extend