ApiRange

class ApiRange

Description

Class representing a range.

Instance Methods

GetClassType(): range

Returns a type of the ApiRange class.

GetRow(): number

Returns a row number for the selected cell.

GetCol(): number

Returns a column number for the selected cell.

Clear()

Clears the current range.

GetRows(nRow): ApiRange | "null"

R.

GetCols(nCol): ApiRange | "null"

Returns a Range object that represents the columns in the specified range.

End(direction): ApiRange

Returns a Range object that represents the end in the specified direction in the specified range.

GetCells(row, col): ApiRange

Returns a Range object that represents all the cells in the specified range or a specified cell.

SetOffset(nRow, nCol)

Sets the cell offset.

GetAddress(RowAbs, ColAbs, RefStyle, External, RelativeTo): string | "null"

Returns the range address.

GetCount(): number

Returns the rows or columns count.

GetValue(): string | string[][]

Returns a value of the specified range.

SetValue(data): boolean

Sets a value to the current cell or cell range.

GetFormula(): string | string[][]

Returns a formula of the specified range.

GetValue2(): string | string[][]

Returns the Value2 property (value without format) of the specified range.

GetText(): string | string[][]

Returns the text of the specified range.

SetFontColor(oColor)

Sets the text color to the current cell range with the previously created color object.

GetHidden(): boolean

R.

SetHidden(isHidden)

S.

GetColumnWidth(): number

Returns the column width value.

SetColumnWidth(nWidth)

S.

GetRowHeight(): pt

Returns the row height value.

SetRowHeight(nHeight)

Sets the row height value.

SetFontSize(nSize)

Sets the font size to the characters of the current cell range.

SetFontName(sName)

Sets the specified font family as the font name for the current cell range.

SetAlignVertical(sAligment): boolean

Sets the vertical alignment of the text in the current cell range.

SetAlignHorizontal(sAlignment): boolean

Sets the horizontal alignment of the text in the current cell range.

SetBold(isBold)

Sets the bold property to the text characters in the current cell or cell range.

SetItalic(isItalic)

Sets the italic property to the text characters in the current cell or cell range.

SetUnderline(undelineType)

Specifies that the contents of the current cell / cell range are displayed along with a line appearing directly below the character.

SetStrikeout(isStrikeout)

Specifies that the contents of the cell / cell range are displayed with a single horizontal line through the center of the contents.

SetWrap(isWrap)

Specifies whether the words in the cell must be wrapped to fit the cell size or not.

GetWrapText(): boolean

Returns the information about the wrapping cell style.

SetFillColor(oColor)

S.

GetFillColor(): ApiColor | No Fill

R.

GetNumberFormat(): string | "null"

Returns a value that represents the format code for the current range.

SetNumberFormat(sFormat)

Specifies whether a number in the cell should be treated like number, currency, date, time, etc. or just like text.

SetBorders(bordersIndex, lineStyle, oColor)

Sets the border to the cell / cell range with the parameters specified.

Merge(isAcross)

Merges the selected cell range into a single cell or a cell row.

UnMerge()

Splits the selected merged cell range into the single cells.

ForEach(fCallback)

Executes a provided function once for each cell.

AddComment(sText, sAuthor): ApiComment | "null"

Adds a comment to the current range.

GetWorksheet(): ApiWorksheet

R.

GetDefName(): ApiName

Returns the ApiName object of the current range.

GetComment(): ApiComment | "null"

Returns the ApiComment object of the current range.

Select()

Selects the current range.

GetOrientation(): Angle

Returns the current range angle.

SetOrientation(angle)

Sets an angle to the current cell range.

SetSort(key1, sSortOrder1, key2, sSortOrder2, key3, sSortOrder3, sHeader, sOrientation)

Sorts the cells in the given range by the parameters specified in the request.

Delete(shift)

Deletes the Range object.

Insert(shift)

Inserts a cell or a range of cells into the worksheet or macro sheet and shifts other cells away to make space.

AutoFit(bRows, bCols)

Changes the width of the columns or the height of the rows in the range to achieve the best fit.

GetAreas(): ApiAreas

Returns a collection of the ranges.

Copy(destination)

Copies the range to the specified range or to the clipboard.

Cut(destination)

Cuts the range and save it to the clipboard or paste it to the specified range.

Paste(rangeFrom)

Pastes the Range object to the specified range.

PasteSpecial(sPasteType, sPasteSpecialOperation, bSkipBlanks, bTranspose)

Pastes the Range object to the specified range using the special paste options.

GetPivotTable(): ApiPivotTable | "null"

Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.

Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase): ApiRange | "null"

Finds specific information in the current range.

FindNext(After): ApiRange | "null"

C.

FindPrevious(Before): ApiRange | "null"

C.

Replace(What, Replacement, LookAt, SearchOrder, SearchDirection, MatchCase, ReplaceAll)

Replaces specific information to another one in a range.

GetCharacters(Start, Length): ApiCharacters

R.

Instance Properties

Rownumber

Returns the row number for the selected cell.

Colnumber

Returns the column number for the selected cell.

RowsApiRange

Returns the ApiRange object that represents the rows of the specified range.

ColsApiRange

Returns the ApiRange object that represents the columns of the specified range.

CellsApiRange

Returns a Range object that represents all the cells in the specified range or a specified cell.

Countnumber

Returns the rows or columns count.

Addressstring

Returns the range address.

Valuestring

Returns a value from the first cell of the specified range or sets it to this cell.

Formulastring

Returns a formula from the first cell of the specified range or sets it to this cell.

Value2string

Returns the value2 (value without format) from the first cell of the specified range or sets it to this cell.

Textstring

Returns the text from the first cell of the specified range or sets it to this cell.

FontColorApiColor

Sets the text color to the current cell range with the previously created color object.

Hiddenboolean

Returns or sets the value hiding property.

ColumnWidthnumber

Returns or sets the width of all the columns in the specified range measured in points.

Widthnumber

Returns a value that represents the range width measured in points.

RowHeightnumber

Returns or sets the height of the first row in the specified range measured in points.

Heightnumber

Returns a value that represents the range height measured in points.

FontSizenumber

Sets the font size to the characters of the current cell range.

FontNamestring

Sets the specified font family as the font name for the current cell range.

AlignVerticalcenter | bottom | top | distributed | justify

Sets the text vertical alignment to the current cell range.

AlignHorizontalleft | right | center | justify

Sets the text horizontal alignment to the current cell range.

Boldboolean

Sets the bold property to the text characters from the current cell or cell range.

Italicboolean

Sets the italic property to the text characters in the current cell or cell range.

Underlinenone | single | singleAccounting | double | doubleAccounting

Sets the type of underline applied to the font.

Strikeoutboolean

Sets a value that indicates whether the contents of the current cell or cell range are displayed struck through.

WrapTextboolean

Returns the information about the wrapping cell style or specifies whether the words in the cell must be wrapped to fit the cell size or not.

FillColorApiColor | No Fill

Returns or sets the background color of the current cell range.

NumberFormatstring

Sets a value that represents the format code for the object.

MergeAreaApiRange

Returns the cell or cell range from the merge area.

WorksheetApiWorksheet

Returns the ApiWorksheet object that represents the worksheet containing the specified range.

DefNameApiName

Returns the ApiName object.

CommentsApiComment | "null"

Returns the ApiComment collection that represents all the comments from the specified worksheet.

OrientationxlDownward | xlHorizontal | xlUpward | xlVertical

Sets an angle to the current cell range.

AreasApiAreas

Returns a collection of the areas.

CharactersApiCharacters

R.

PivotTableApiPivotTable | "null"

Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).