@univerjs/core v0.5.0-beta.1 • Docs
Class: Range
Beta
Access and modify spreadsheet ranges.
Remarks
A range can be a single cell in a sheet or a group of adjacent cells in a sheet.
Reference from: https://developers.google.com/apps-script/reference/spreadsheet/range
Constructors
new Range()
new Range(
workSheet,
range,
_deps): Range
Beta
Parameters
Parameter | Type |
---|---|
workSheet | Worksheet |
range | IRange |
_deps | IRangeDependencies |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:107
Methods
forEach()
forEach(action): void
Beta
Parameters
Parameter | Type |
---|---|
action | (row , column ) => void |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:734
getA1Notation()
getA1Notation(): string
Beta
Returns a string description of the range, in A1 notation.
Returns
string
The string description of the range in A1 notation.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:256
getBackground()
getBackground(): string
Beta
Returns the background color of the top-left cell in the range (for example, ‘#ffffff’).
Returns
string
— The color code of the background.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:277
getBackgrounds()
getBackgrounds(): string[][]
Beta
Returns the background colors of the cells in the range (for example, ‘#ffffff’).
Returns
string
[][]
— A two-dimensional array of color codes of the backgrounds.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:286
getBorder()
getBorder(): IBorderData
Beta
Returns the border info of the cells in the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:493
getBorders()
getBorders(): IBorderData[][]
Beta
Returns
IBorderData
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:497
getCell()
getCell(row, column): Range
Beta
Returns a given cell within a range.
The row and column here are relative to the range e.g. “B2:D4”, getCell(0,0) in this code returns the cell at B2
Parameters
Parameter | Type |
---|---|
row | number |
column | number |
Returns
— A range containing a single cell at the specified coordinates.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:303
getColumn()
getColumn(): number
Beta
Returns the starting column position for this range
Returns
number
— The range’s starting column position in the spreadsheet.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:320
getFontColor()
getFontColor(): string
Beta
Returns the font color of the cell in the top-left corner of the range, in CSS notation
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:368
getFontColors()
getFontColors(): string[][]
Beta
Returns the font colors of the cells in the range in CSS notation (such as ‘#ffffff’ or ‘white’).
Returns
string
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:375
getFontFamilies()
getFontFamilies(): string[][]
Beta
Returns the font families of the cells in the range.
Returns
string
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:388
getFontFamily()
getFontFamily(): string
Beta
Returns the font family of the cell in the top-left corner of the range.
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:395
getFontSize()
getFontSize(): number
Beta
Returns the font size in point size of the cell in the top-left corner of the range.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:468
getFontSizes()
getFontSizes(): number[][]
Beta
Returns the font sizes of the cells in the range.
Returns
number
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:485
getFontStyle()
getFontStyle(): FontItalic
Beta
Returns the font style (‘italic’ or ‘normal’) of the cell in the top-left corner of the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:504
getFontWeight()
getFontWeight(): FontWeight
Beta
Returns the font weight (normal/bold) of the cell in the top-left corner of the range. If the cell has rich text, the return value according to the textRuns of the rich text, when all styles of textRuns are bold, it will return FontWeight.BOLD, otherwise return FontWeight.NORMAL.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:529
getGridId()
getGridId(): string
Beta
Returns the grid ID of the range’s parent sheet.
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:551
getHeight()
getHeight(): number
Beta
Returns the height of the range.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:558
getHorizontalAlignment()
getHorizontalAlignment(): HorizontalAlign
Beta
Returns the horizontal alignment of the text (left/center/right) of the cell in the top-left corner of the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:572
getHorizontalAlignments()
getHorizontalAlignments(): HorizontalAlign[][]
Beta
Returns the horizontal alignments of the cells in the range.
Returns
HorizontalAlign
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:579
getLastColumn()
getLastColumn(): number
Beta
Returns the end column position.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:586
getLastRow()
getLastRow(): number
Beta
Returns the end row position.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:593
getMatrix()
getMatrix(): ObjectMatrix<Nullable<ICellData>>
Beta
get range matrix
Returns
ObjectMatrix
<Nullable
<ICellData
>>
range matrix
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:216
getMatrixObject()
getMatrixObject(): ObjectMatrix<ICellData>
Beta
get range matrix object
Returns
range matrix object
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:236
getNumColumns()
getNumColumns(): number
Beta
Returns the number of columns in this range.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:600
getNumRows()
getNumRows(): number
Beta
Returns the number of rows in this range.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:608
getObjectValue()
getObjectValue(options): Nullable<ICellData>
Beta
Returns the data of the object structure, and can set whether to bring styles
Parameters
Parameter | Type |
---|---|
options | IValueOptionsType |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:327
getObjectValues()
getObjectValues(options): IObjectMatrixPrimitiveType<Nullable<ICellData>>
Beta
Returns the data of the object structure, and can set whether to bring styles
Parameters
Parameter | Type | Description |
---|---|---|
options | IValueOptionsType | set whether to include style |
Returns
IObjectMatrixPrimitiveType
<Nullable
<ICellData
>>
Returns a value in object format
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:337
getOverline()
getOverline(): ITextDecoration
Beta
Returns the overline of the cells in the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:435
getOverlines()
getOverlines(): ITextDecoration[][]
Beta
Returns the overlines of the cells in the range.
Returns
ITextDecoration
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:428
getRangeData()
getRangeData(): IRange
Beta
get current range data
Returns
current range
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:169
getRichTextValue()
getRichTextValue(): Nullable<"" | IDocumentData>
Beta
Returns the Rich Text value for the top left cell of the range, or null if the cell value is not text.
Returns
Nullable
<""
| IDocumentData
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:616
getRichTextValues()
getRichTextValues(): Nullable<"" | IDocumentData>[][]
Beta
Returns the Rich Text values for the cells in the range.
Returns
Nullable
<""
| IDocumentData
>[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:623
getRowIndex()
getRowIndex(): number
Beta
Returns the row position for this range.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:630
getSheet()
getSheet(): Worksheet
Beta
Returns the sheet this range belongs to.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:637
getStrikeThrough()
getStrikeThrough(): ITextDecoration
Beta
Returns the strikeThrough of the cells in the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:442
getTextDirection()
getTextDirection(): number
Beta
Returns the text direction for the top left cell of the range.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:644
getTextDirections()
getTextDirections(): number[][]
Beta
Returns the text directions for the cells in the range.
Returns
number
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:651
getTextRotation()
getTextRotation(): ITextRotation
Beta
Returns the text rotation settings for the top left cell of the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:659
getTextRotations()
getTextRotations(): ITextRotation[][]
Beta
Returns the text rotation settings for the cells in the range.
Returns
ITextRotation
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:667
getTextStyle()
getTextStyle(): Nullable<IStyleData>
Beta
Returns the text style for the top left cell of the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:674
getTextStyles()
getTextStyles(): Nullable<IStyleData>[][]
Beta
Returns the text styles for the cells in the range.
Returns
Nullable
<IStyleData
>[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:681
getUnderline()
getUnderline(): ITextDecoration
Beta
Returns the underline of the cells in the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:409
getUnderlines()
getUnderlines(): ITextDecoration[][]
Beta
Returns the underlines of the cells in the range.
Returns
ITextDecoration
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:402
getValue()
getValue(): Nullable<ICellData>
Beta
Returns the value of the top-left cell in the range. The value may be of type Number, Boolean, Date, or String depending on the value of the cell. Empty cells return an empty string.
Returns
The value in this cell
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:178
getValues()
getValues(): Nullable<ICellData>[][]
Beta
Returns the rectangular grid of values for this range.
Returns a two-dimensional array of values, indexed by row, then by column. The values may be of type Number, Boolean, Date, or String, depending on the value of the cell. Empty cells are represented by an empty string in the array. Remember that while a range index starts at 0, 0, same as the JavaScript array is indexed from [0][0].
In web apps, a Date value isn’t a legal parameter. getValues() fails to return data to a web app if the range contains a cell with a Date value. Instead, transform all the values retrieved from the sheet to a supported JavaScript primitive like a Number, Boolean, or String.
Returns
A two-dimensional array of values.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:195
getVerticalAlignment()
getVerticalAlignment(): VerticalAlign
Beta
Returns the vertical alignment (top/middle/bottom) of the cell in the top-left corner of the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:689
getVerticalAlignments()
getVerticalAlignments(): VerticalAlign[][]
Beta
Returns the vertical alignments of the cells in the range.
Returns
VerticalAlign
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:696
getWidth()
getWidth(): number
Beta
Returns the width of the range in columns.
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:703
getWrap()
getWrap(): BooleanNumber
Beta
Returns whether the text in the cell wraps.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:716
getWrapStrategies()
getWrapStrategies(): WrapStrategy[][]
Beta
Returns the text wrapping strategies for the cells in the range.
Returns
WrapStrategy
[][]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:723
getWrapStrategy()
getWrapStrategy(): WrapStrategy
Beta
Returns the text wrapping strategy for the top left cell of the range.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:730
foreach()
static foreach(range, action): void
Beta
Parameters
Parameter | Type |
---|---|
range | IRange |
action | (row , column ) => void |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:116
transformRange()
static transformRange(range, worksheet): IRange
Beta
Parameters
Parameter | Type |
---|---|
range | IRange |
worksheet | Worksheet |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:125