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
Parameter | Type |
---|---|
_workbook | Workbook |
_worksheet | Worksheet |
_range | IRange |
_injector | Injector |
_commandService | ICommandService |
_formulaDataModel | FormulaDataModel |
Returns
Inherited from
Properties
Property | Modifier | Type | Default value | Inherited from | Defined in |
---|---|---|---|---|---|
_commandService | readonly | ICommandService | undefined | FRange ._commandService | sheets/src/facade/f-range.ts:36 |
_disposed | protected | boolean | false | FRange ._disposed | core/src/shared/lifecycle.ts:96 |
_formulaDataModel | readonly | FormulaDataModel | undefined | FRange ._formulaDataModel | sheets/src/facade/f-range.ts:37 |
_injector | readonly | Injector | undefined | FRange ._injector | sheets/src/facade/f-range.ts:35 |
_range | readonly | IRange | undefined | FRange ._range | sheets/src/facade/f-range.ts:34 |
_workbook | readonly | Workbook | undefined | FRange ._workbook | sheets/src/facade/f-range.ts:32 |
_worksheet | readonly | Worksheet | undefined | FRange ._worksheet | sheets/src/facade/f-range.ts:33 |
Methods
_initialize()
_initialize(injector): void
Defined in: core/src/facade/f-base.ts:66
Parameters
Parameter | Type |
---|---|
injector | Injector |
Returns
void
Inherited from
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
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
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
This range, for chaining.
Description
If the range is not a single cell, an error will be thrown.
Inherited from
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
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
dispose()
dispose(): void
Defined in: core/src/shared/lifecycle.ts:109
Returns
void
Inherited from
disposeWithMe()
disposeWithMe(disposable): IDisposable
Defined in: core/src/shared/lifecycle.ts:99
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
ensureNotDisposed()
protected ensureNotDisposed(): void
Defined in: core/src/shared/lifecycle.ts:103
Returns
void
Inherited from
forEach()
forEach(callback): void
Defined in: sheets/src/facade/f-range.ts:950
Iterate cells in this range. Merged cells will be respected.
Parameters
Parameter | Type | Description |
---|---|---|
callback | (row , col , cell ) => void | the callback function to be called for each cell in the range |
Returns
void
Inherited from
getA1Notation()
getA1Notation(withSheet?): string
Defined in: sheets/src/facade/f-range.ts:971
Returns a string description of the range, in A1 notation.
Parameters
Parameter | Type |
---|---|
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
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
getCellDataGrid()
getCellDataGrid(): Nullable<ICellData>[][]
Defined in: sheets/src/facade/f-range.ts:202
Returns
Deprecated
use getCellDatas
instead.
Inherited from
getCellDatas()
getCellDatas(): Nullable<ICellData>[][]
Defined in: sheets/src/facade/f-range.ts:185
Returns the cell data for the cells in the range.
Returns
A two-dimensional array of cell data.
Example
univerAPI.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.getCellDatas()
Inherited from
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
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
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
The custom meta data
Example
univerAPI.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.getCustomMetaData()
Inherited from
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
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
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
getHorizontalAlignment()
getHorizontalAlignment(): string
Defined in: sheets/src/facade/f-range.ts:313
Returns
string
Inherited from
getRange()
getRange(): IRange
Defined in: sheets/src/facade/f-range.ts:70
Gets the area where the statement is applied
Returns
The area where the statement is applied
Inherited from
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
The rich text value
Example
univerAPI.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.getRichTextValue()
Inherited from
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
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
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
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
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
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
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
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
A two-dimensional array of values.
Inherited from
getVerticalAlignment()
getVerticalAlignment(): string
Defined in: sheets/src/facade/f-range.ts:317
Returns
string
Inherited from
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
getWrap()
getWrap(): boolean
Defined in: sheets/src/facade/f-range.ts:305
Returns
boolean
Inherited from
getWrapStrategy()
getWrapStrategy(): WrapStrategy
Defined in: sheets/src/facade/f-range.ts:309
Returns
Inherited from
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
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
merge()
merge(defaultMerge?): FRange
Defined in: sheets/src/facade/f-range.ts:835
Merge cells in a range into one merged cell
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
defaultMerge ? | boolean | true | If true, only the value in the upper left cell is retained. |
Returns
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
mergeAcross()
mergeAcross(defaultMerge?): FRange
Defined in: sheets/src/facade/f-range.ts:858
Merges cells in a range horizontally.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
defaultMerge ? | boolean | true | If true, only the value in the upper left cell is retained. |
Returns
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
mergeVertically()
mergeVertically(defaultMerge?): FRange
Defined in: sheets/src/facade/f-range.ts:882
Merges cells in a range vertically.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
defaultMerge ? | boolean | true | If true, only the value in the upper left cell is retained. |
Returns
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
removeThemeStyle()
removeThemeStyle(themeName): void
Defined in: sheets/src/facade/f-range.ts:1118
Remove the theme style for the range.
Parameters
Parameter | Type | Description |
---|---|---|
themeName | string | The 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
setBackground()
setBackground(color): FRange
Defined in: sheets/src/facade/f-range.ts:421
Set background color for current range.
Parameters
Parameter | Type | Description |
---|---|---|
color | string | {string} |
Returns
Example
univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
Inherited from
setBackgroundColor()
setBackgroundColor(color): FRange
Defined in: sheets/src/facade/f-range.ts:398
Set background color for current range.
Parameters
Parameter | Type | Description |
---|---|---|
color | string | {string} |
Returns
Example
univerAPI.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.setBackgroundColor('red')
Inherited from
setCustomMetaData()
setCustomMetaData(data): FRange
Defined in: sheets/src/facade/f-range.ts:332
Set custom meta data for first cell in current range.
Parameters
Parameter | Type | Description |
---|---|---|
data | CustomData | The custom meta data |
Returns
This range, for chaining
univerAPI.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.setCustomMetaData({ key: 'value' });
Inherited from
setCustomMetaDatas()
setCustomMetaDatas(datas): FRange
Defined in: sheets/src/facade/f-range.ts:349
Set custom meta data for current range.
Parameters
Parameter | Type | Description |
---|---|---|
datas | CustomData [][] | The custom meta data |
Returns
This range, for chaining
univerAPI.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.setCustomMetaDatas([[{ key: 'value' }]]);
Inherited from
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
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
Inherited from
setFontFamily()
setFontFamily(fontFamily): this
Defined in: sheets/src/facade/f-range.ts:756
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
Inherited from
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
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
Inherited from
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
Parameter | Type | Description |
---|---|---|
size | null | number | A font size in point size. A null value resets the font size. |
Returns
this
Inherited from
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
Parameter | Type | Description |
---|---|---|
fontStyle | null | FontStyle | The font style, either ‘italic’ or ‘normal’; a null value resets the font style. |
Returns
this
Inherited from
setFontWeight()
setFontWeight(fontWeight): this
Defined in: sheets/src/facade/f-range.ts:623
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
Inherited from
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
Parameter | Type |
---|---|
alignment | FHorizontalAlignment |
Returns
Inherited from
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
Parameter | Type | Description |
---|---|---|
value | | IDocumentData | RichTextValue | The rich text value |
Returns
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
Parameter | Type | Description |
---|---|---|
values | ( | IDocumentData | RichTextValue )[][] | The rich text value |
Returns
The range
Example
univerAPI
.getActiveWorkbook()
.getActiveSheet()
.getActiveRange()
.setRichTextValues([[new RichTextValue().insertText('Hello')]]);
Inherited from
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
Parameter | Type | Description |
---|---|---|
value | | ICellData | CellValue | 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. |
Returns
Inherited from
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
Parameter | Type | Description |
---|---|---|
value | | ICellData | CellValue | 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. univerAPI.getActiveWorkbook() .getActiveSheet() .getActiveRange() .setValueForCell(1); |
Returns
Inherited from
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
Parameter | Type |
---|---|
value | | IObjectMatrixPrimitiveType <ICellData > | ICellData [][] | IObjectMatrixPrimitiveType <CellValue > | CellValue [][] |
Returns
Inherited from
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
Parameter | Type |
---|---|
alignment | FVerticalAlignment |
Returns
Inherited from
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
Parameter | Type |
---|---|
isWrapEnabled | boolean |
Returns
Inherited from
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
Parameter | Type |
---|---|
strategy | WrapStrategy |
Returns
Inherited from
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
Parameter | Type | Description |
---|---|---|
column | | SortColumnSpec | SortColumnSpec [] | The column index with order or an array of column indexes with order. The column index starts from 1. |
Returns
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
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
Parameter | Type | Description |
---|---|---|
treatMultipleDelimitersAsOne ? | boolean | Whether 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
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
Parameter | Type | Description |
---|---|---|
treatMultipleDelimitersAsOne ? | boolean | Whether to treat multiple continuous delimiters as one. The default value is false. |
delimiter ? | SplitDelimiterEnum | 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 |
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
useThemeStyle()
useThemeStyle(themeName): void
Defined in: sheets/src/facade/f-range.ts:1091
Set the theme style for the range.
Parameters
Parameter | Type | Description |
---|---|---|
themeName | undefined | string | The 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
extend()
static extend(source): void
Defined in: core/src/facade/f-base.ts:68
Parameters
Parameter | Type |
---|---|
source | any |
Returns
void