ApiRange

class ApiRange

Description

Class representing a continuous region in a document. Each Range object is determined by the position of the start and end characters.

Instance Methods

GetClassType(): range

Returns a type of the ApiRange class.

GetParagraph(nPos): ApiParagraph | "null"

Returns a paragraph from all the paragraphs that are in the range.

AddText(sText, sPosition): boolean

Adds a text to the specified position.

AddBookmark(sName): boolean

Adds a bookmark to the specified range.

AddHyperlink(sLink, sScreenTipText): ApiHyperlink | "null"

Adds a hyperlink to the specified range.

GetText(oPr, oPr.NewLineParagraph, oPr.Numbering, oPr.Math, oPr.NewLineSeparator, oPr.TableCellSeparator, oPr.TableRowSeparator, oPr.ParaSeparator, oPr.TabSymbol): String

Returns a text from the specified range.

GetAllParagraphs(): ApiParagraph[]

Returns a collection of paragraphs that represents all the paragraphs in the specified range.

Select()

Sets the selection to the specified range.

ExpandTo(oRange): ApiRange | "null"

Returns a new range that goes beyond the specified range in any direction and spans a different range.

IntersectWith(oRange): ApiRange | "null"

Returns a new range as the intersection of the current range with another range.

SetBold(isBold): ApiRange | "null"

Sets the bold property to the text character.

SetCaps(isCaps): ApiRange | "null"

Specifies that any lowercase characters in the current text Range are formatted for display only as their capital letter character equivalents.

SetColor(r, g, b, isAuto): ApiRange | "null"

Sets the text color to the current text Range in the RGB format.

SetDoubleStrikeout(isDoubleStrikeout): ApiRange | "null"

Specifies that the contents of the current Range are displayed with two horizontal lines through each character displayed on the line.

SetHighlight(sColor): ApiRange | "null"

Specifies a highlighting color which is applied as a background to the contents of the current Range.

SetShd(sType, r, g, b): ApiRange | "null"

Specifies the shading applied to the contents of the current text Range.

SetItalic(isItalic): ApiRange | "null"

Sets the italic property to the text character.

SetStrikeout(isStrikeout): ApiRange | "null"

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

SetSmallCaps(isSmallCaps): ApiRange | "null"

Specifies that all the lowercase letter characters in the current text Range are formatted for display only as their capital letter character equivalents which are two points smaller than the actual font size specified for this text.

SetSpacing(nSpacing): ApiRange | "null"

Sets the text spacing measured in twentieths of a point.

SetUnderline(isUnderline): ApiRange | "null"

Specifies that the contents of the current Range are displayed along with a line appearing directly below the character (less than all the spacing above and below the characters on the line).

SetVertAlign(sType): ApiRange | "null"

Specifies the alignment which will be applied to the Range contents in relation to the default appearance of the Range text: "baseline" - the characters in the current text Range will be aligned by the default text baseline.

SetPosition(nPosition): ApiRange | "null"

Specifies the amount by which text is raised or lowered for the current Range in relation to the default baseline of the surrounding non-positioned text.

SetFontSize(FontSize): ApiRange | "null"

Sets the font size to the characters of the current text Range.

SetFontFamily(sFontFamily): ApiRange | "null"

Sets all 4 font slots with the specified font family.

SetStyle(oStyle): ApiRange | "null"

Sets the style to the current Range.

SetTextPr(oTextPr): ApiRange | "null"

Sets the text properties to the current Range.

GetTextPr(): ApiTextPr

Returns the merged text properties of entire range.

Delete(): boolean

Deletes all the contents from the current range.

ToJSON(bWriteNumberings, bWriteStyles): JSON

Converts the ApiRange object into the JSON object.

AddComment(sText, sAuthor, sUserId): ApiComment

Adds a comment to the current range.

GetRange(Start, End): ApiRange

Returns a Range object that represents the document part contained in the specified range.

GetStartPage(): Number

Returns the start page number of current range.

GetEndPage(): Number

Returns the end page number of current range.

SetStartPos(nPos): boolean

Sets the start position of a current range object.

SetEndPos(nPos): boolean

Sets the start position of a current range object.

GetStartPos(): number

Returns the start position of a current range.

GetEndPos(): number

Returns the end position of a current 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).