ApiRun

class ApiRun extends ApiTextPr

Description

Class representing a small text block called 'run'.

Instance Methods

GetClassType(): run

Returns a type of the ApiRun class.

GetTextPr(): ApiTextPr

Returns the text properties of the current run.

ClearContent()

Clears the content from the current run.

RemoveAllElements()

Removes all the elements from the current run.

Delete()

Deletes the current run.

AddText(sText)

Adds some text to the current run.

AddPageBreak()

Adds a page break and starts the next element from a new page.

AddLineBreak()

Adds a line break to the current run position and starts the next element from a new line.

AddColumnBreak()

Adds a column break to the current run position and starts the next element from a new column.

AddTabStop()

Adds a tab stop to the current run.

AddDrawing(oDrawing): boolean

Adds a drawing object (image, shape or chart) to the current text run.

Select(): boolean

Selects the current run.

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

Adds a hyperlink to the current run.

Copy(): ApiRun

Creates a copy of the current run.

GetRange(Start, End): ApiRange

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

GetParentContentControl(): ApiBlockLvlSdt | ApiInlineLvlSdt | "null"

Returns a content control that contains the current run.

GetParentTable(): ApiTable | "null"

Returns a table that contains the current run.

GetParentTableCell(): ApiTableCell | "null"

Returns a table cell that contains the current run.

SetTextPr(oTextPr): ApiTextPr

Sets the text properties to the current run.

SetBold(isBold): ApiTextPr

Sets the bold property to the text character.

SetCaps(isCaps): ApiTextPr

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

SetColor(r, g, b, isAuto): ApiTextPr

Sets the text color for the current text run in the RGB format.

SetDoubleStrikeout(isDoubleStrikeout): ApiTextPr

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

SetFontFamily(sFontFamily): ApiTextPr

Sets all 4 font slots with the specified font family.

GetFontNames(): string[]

Returns all font names from all elements inside the current run.

SetFontSize(nSize): ApiTextPr

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

SetHighlight(sColor): ApiTextPr

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

SetItalic(isItalic): ApiTextPr

Sets the italic property to the text character.

SetLanguage(sLangId): ApiTextPr

Specifies the languages which will be used to check spelling and grammar (if requested) when processing the contents of this text run.

SetPosition(nPosition): ApiTextPr

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

SetShd(sType, r, g, b): ApiTextPr

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

SetSmallCaps(isSmallCaps): ApiTextPr

Specifies that all the small letter characters in this text run 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): ApiTextPr

Sets the text spacing measured in twentieths of a point.

SetStrikeout(isStrikeout): ApiTextPr

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

SetStyle(oStyle): ApiTextPr

Sets a style to the current run.

SetUnderline(isUnderline): ApiTextPr

Specifies that the contents of the current run 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): ApiTextPr

Specifies the alignment which will be applied to the contents of the current run in relation to the default appearance of the text run: "baseline" .

WrapInMailMergeField()

Wraps a run in a mail merge field.

ToJSON(bWriteStyles): JSON

Converts the ApiRun object into the JSON object.

AddComment(sText, sAuthor, sUserId): ApiComment

A.

GetText(oPr, oPr.NewLineSeparator, oPr.TabSymbol): string

Returns a text from the text run.

MoveCursorToPos(nPos): boolean

M.

GetStyle()

Gets the style of the current text properties.

GetBold()

Gets the bold property from the current text properties.

GetItalic()

Gets the italic property from the current text properties.

GetStrikeout()

Gets the strikeout property from the current text properties.

GetUnderline()

Gets the underline property from the current text properties.

GetFontFamily()

Gets the font family from the current text properties.

GetFontSize()

Gets the font size from the current text properties.

GetColor()

Gets the RGB color from the current text properties.

GetVertAlign()

Gets the vertical alignment type from the current text properties.

GetHighlight()

Gets the highlight property from the current text properties.

GetSpacing()

Gets the text spacing from the current text properties measured in twentieths of a point.

GetDoubleStrikeout()

Gets the double strikeout property from the current text properties.

GetCaps()

Specifies whether the text with the current text properties are capitalized.

GetSmallCaps()

Specifies whether the text with the current text properties are displayed capitalized two points smaller than the actual font size.

GetPosition()

Gets the text position from the current text properties measured in half-points (1/144 of an inch).

GetLanguage()

Gets the language from the current text properties.

GetShd()

Gets the text shading from the current text properties.

SetTextFill(oApiFill)

Sets the text fill to the current text run.

GetTextFill()

Gets the text fill from the current text properties.

SetOutLine(oStroke)

Sets the text outline to the current text run.

GetOutLine()

Gets the text outline from the current text properties.

Extends

ApiTextPr

Class representing the text properties.

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).