GetRange
Returns a Range object that represents the part of the document contained in the specified content control.
Syntax
expression.GetRange(Start, End);
expression - A variable that represents a ApiInlineLvlSdt class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| Start | Required | Number | Start position index in the current element. | |
| End | Required | Number | End position index in the current element. |
Returns
Example
Extract a text range from within an inline content control in a document.
// How do I select a specific portion of text inside an inline content control in a document?
// Apply bold formatting to a substring inside a content control by targeting its range in a document.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let inlineLvlSdt = Api.CreateInlineLvlSdt();
inlineLvlSdt.AddText("This is an inline text content control.");
paragraph.AddInlineLvlSdt(inlineLvlSdt);
let range = inlineLvlSdt.GetRange(11, 16);
range.SetBold(true);