Class: Range
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:102
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
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:107
Beta
Parameters
Parameter | Type |
---|---|
workSheet | Worksheet |
range | IRange |
_deps | IRangeDependencies |
Returns
Methods
forEach()
forEach(action): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:734
Beta
Parameters
Parameter | Type |
---|---|
action | (row , column ) => void |
Returns
void
getA1Notation()
getA1Notation(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:256
Beta
Returns a string description of the range, in A1 notation.
Returns
string
The string description of the range in A1 notation.
getBackground()
getBackground(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:277
Beta
Returns the background color of the top-left cell in the range (for example, ‘#ffffff’).
Returns
string
— The color code of the background.
getBackgrounds()
getBackgrounds(): string[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:286
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.
getBorder()
getBorder(): IBorderData
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:493
Beta
Returns the border info of the cells in the range.
Returns
getBorders()
getBorders(): IBorderData[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:497
Beta
Returns
IBorderData
[][]
getCell()
getCell(row, column): Range
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:303
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.
getColumn()
getColumn(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:320
Beta
Returns the starting column position for this range
Returns
number
— The range’s starting column position in the spreadsheet.
getFontColor()
getFontColor(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:368
Beta
Returns the font color of the cell in the top-left corner of the range, in CSS notation
Returns
string
getFontColors()
getFontColors(): string[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:375
Beta
Returns the font colors of the cells in the range in CSS notation (such as ‘#ffffff’ or ‘white’).
Returns
string
[][]
getFontFamilies()
getFontFamilies(): string[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:388
Beta
Returns the font families of the cells in the range.
Returns
string
[][]
getFontFamily()
getFontFamily(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:395
Beta
Returns the font family of the cell in the top-left corner of the range.
Returns
string
getFontSize()
getFontSize(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:468
Beta
Returns the font size in point size of the cell in the top-left corner of the range.
Returns
number
getFontSizes()
getFontSizes(): number[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:485
Beta
Returns the font sizes of the cells in the range.
Returns
number
[][]
getFontStyle()
getFontStyle(): FontItalic
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:504
Beta
Returns the font style (‘italic’ or ‘normal’) of the cell in the top-left corner of the range.
Returns
getFontWeight()
getFontWeight(): FontWeight
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:529
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
getGridId()
getGridId(): string
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:551
Beta
Returns the grid ID of the range’s parent sheet.
Returns
string
getHeight()
getHeight(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:558
Beta
Returns the height of the range.
Returns
number
getHorizontalAlignment()
getHorizontalAlignment(): HorizontalAlign
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:572
Beta
Returns the horizontal alignment of the text (left/center/right) of the cell in the top-left corner of the range.
Returns
getHorizontalAlignments()
getHorizontalAlignments(): HorizontalAlign[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:579
Beta
Returns the horizontal alignments of the cells in the range.
Returns
HorizontalAlign
[][]
getLastColumn()
getLastColumn(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:586
Beta
Returns the end column position.
Returns
number
getLastRow()
getLastRow(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:593
Beta
Returns the end row position.
Returns
number
getMatrix()
getMatrix(): ObjectMatrix<Nullable<ICellData>>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:216
Beta
get range matrix
Returns
ObjectMatrix
<Nullable
<ICellData
>>
range matrix
getMatrixObject()
getMatrixObject(): ObjectMatrix<ICellData>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:236
Beta
get range matrix object
Returns
range matrix object
getNumColumns()
getNumColumns(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:600
Beta
Returns the number of columns in this range.
Returns
number
getNumRows()
getNumRows(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:608
Beta
Returns the number of rows in this range.
Returns
number
getObjectValue()
getObjectValue(options): Nullable<ICellData>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:327
Beta
Returns the data of the object structure, and can set whether to bring styles
Parameters
Parameter | Type |
---|---|
options | IValueOptionsType |
Returns
getObjectValues()
getObjectValues(options): IObjectMatrixPrimitiveType<Nullable<ICellData>>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:337
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
getOverline()
getOverline(): ITextDecoration
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:435
Beta
Returns the overline of the cells in the range.
Returns
getOverlines()
getOverlines(): ITextDecoration[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:428
Beta
Returns the overlines of the cells in the range.
Returns
ITextDecoration
[][]
getRangeData()
getRangeData(): IRange
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:169
Beta
get current range data
Returns
current range
getRichTextValue()
getRichTextValue(): Nullable<"" | IDocumentData>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:616
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
>
getRichTextValues()
getRichTextValues(): Nullable<"" | IDocumentData>[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:623
Beta
Returns the Rich Text values for the cells in the range.
Returns
Nullable
<""
| IDocumentData
>[][]
getRowIndex()
getRowIndex(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:630
Beta
Returns the row position for this range.
Returns
number
getSheet()
getSheet(): Worksheet
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:637
Beta
Returns the sheet this range belongs to.
Returns
getStrikeThrough()
getStrikeThrough(): ITextDecoration
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:442
Beta
Returns the strikeThrough of the cells in the range.
Returns
getTextDirection()
getTextDirection(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:644
Beta
Returns the text direction for the top left cell of the range.
Returns
number
getTextDirections()
getTextDirections(): number[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:651
Beta
Returns the text directions for the cells in the range.
Returns
number
[][]
getTextRotation()
getTextRotation(): ITextRotation
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:659
Beta
Returns the text rotation settings for the top left cell of the range.
Returns
getTextRotations()
getTextRotations(): ITextRotation[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:667
Beta
Returns the text rotation settings for the cells in the range.
Returns
ITextRotation
[][]
getTextStyle()
getTextStyle(): Nullable<IStyleData>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:674
Beta
Returns the text style for the top left cell of the range.
Returns
getTextStyles()
getTextStyles(): Nullable<IStyleData>[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:681
Beta
Returns the text styles for the cells in the range.
Returns
Nullable
<IStyleData
>[][]
getUnderline()
getUnderline(): ITextDecoration
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:409
Beta
Returns the underline of the cells in the range.
Returns
getUnderlines()
getUnderlines(): ITextDecoration[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:402
Beta
Returns the underlines of the cells in the range.
Returns
ITextDecoration
[][]
getValue()
getValue(): Nullable<ICellData>
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:178
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
getValues()
getValues(): Nullable<ICellData>[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:195
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.
getVerticalAlignment()
getVerticalAlignment(): VerticalAlign
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:689
Beta
Returns the vertical alignment (top/middle/bottom) of the cell in the top-left corner of the range.
Returns
getVerticalAlignments()
getVerticalAlignments(): VerticalAlign[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:696
Beta
Returns the vertical alignments of the cells in the range.
Returns
VerticalAlign
[][]
getWidth()
getWidth(): number
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:703
Beta
Returns the width of the range in columns.
Returns
number
getWrap()
getWrap(): BooleanNumber
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:716
Beta
Returns whether the text in the cell wraps.
Returns
getWrapStrategies()
getWrapStrategies(): WrapStrategy[][]
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:723
Beta
Returns the text wrapping strategies for the cells in the range.
Returns
WrapStrategy
[][]
getWrapStrategy()
getWrapStrategy(): WrapStrategy
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:730
Beta
Returns the text wrapping strategy for the top left cell of the range.
Returns
foreach()
static foreach(range, action): void
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:116
Beta
Parameters
Parameter | Type |
---|---|
range | IRange |
action | (row , column ) => void |
Returns
void
transformRange()
static transformRange(range, worksheet): IRange
Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/range.ts:125
Beta
Parameters
Parameter | Type |
---|---|
range | IRange |
worksheet | Worksheet |