ApiTextRange
Class representing a text range within a presentation shape's text frame.
Properties
| Name | Type | Description |
|---|---|---|
| End | number | Returns or sets the end position of the current range. |
| Start | number | Returns or sets the start position of the current range. |
Methods
The following table lists the available methods.
| Method | Returns | Description |
|---|---|---|
| AddHyperlink | ApiHyperlink | null | undefined | Adds a hyperlink to the current text range. |
| AddText | boolean | Adds a text to the specified position. The current range is expanded to include the added text. |
| Delete | boolean | Deletes the contents of the current text range. |
| ExpandTo | ApiTextRange | null | Returns a new range that spans both this range and the given range. The current range is not changed. |
| Find | ApiTextRange | null | Finds the first occurrence of the given text within this range and returns it as a new ApiTextRange. Returns null if the text is not found. |
| GetAllParagraphs | ApiParagraph[] | Returns all Paragraph objects within this range. |
| GetClassType | "textRange" | Returns the class type identifier. |
| GetEndPos | number | Returns the end position of the current range. |
| GetParagraph | ApiParagraph | null | Returns the paragraph at the given index within this range. Returns null if the index is out of bounds. |
| GetRange | ApiTextRange | null | Returns a new ApiTextRange that represents a sub-range of the current range. |
| GetStartPos | number | Returns the start position of the current range. |
| GetText | string | Returns the text content of the range. Paragraph breaks are represented as "\r". |
| GetTextPr | ApiTextPr | Returns the merged text properties of the entire range. |
| IntersectWith | ApiTextRange | null | Returns a new range that is the intersection of this range and the given range. The current range is not changed. |
| MoveCursorToPos | boolean | Moves a cursor to the specified position within the current range. |
| Replace | ApiTextRange | Replaces all occurrences of the specified text within this range. |
| Select | boolean | Selects the text range in the editor. |
| SetBold | ApiTextRange | Sets bold formatting for the contents of the current text range. |
| SetCaps | ApiTextRange | Specifies that any lowercase characters in the current text Range are formatted for display only as their capital letter character equivalents. |
| SetColor | ApiTextRange | Sets the text color of the current range. |
| SetDoubleStrikeout | ApiTextRange | Specifies that the contents of the current Range are displayed with two horizontal lines through each character displayed on the line. |
| SetEndPos | boolean | Sets the end position of the current range. |
| SetFontFamily | ApiTextRange | null | Sets the font family for the current TextRange. |
| SetFontSize | ApiTextRange | null | Sets the font size of the characters in the current text Range. |
| SetHighlight | ApiTextRange | null | Specifies a highlighting color which is applied as a background to the contents of the current Range. |
| SetItalic | ApiTextRange | Sets the italic property to the text character. |
| SetLanguage | ApiTextRange | null | Specifies the language which will be used to check spelling and grammar (if requested) when processing the contents of the current text range. |
| SetSmallCaps | ApiTextRange | 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 | ApiTextRange | null | Sets the text spacing measured in twentieths of a point. |
| SetStartPos | boolean | Sets the start position of the current range. |
| SetStrikeout | ApiTextRange | Specifies that the contents of the current Range are displayed with a single horizontal line through the range center. |
| SetText | ApiTextRange | Replaces all text content with the given string. Use "\r" to separate paragraphs. |
| SetTextPr | ApiTextRange | null | Sets the text properties to the current text range. |
| SetUnderline | ApiTextRange | 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 | ApiTextRange | 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. "subscript" - the characters in the current text Range will be aligned below the default text baseline. "superscript" - the characters in the current text Range will be aligned above the default text baseline. |
| ToHtml | string | Converts the text range to HTML. |