AddElement
Adds an element to the inline text content control.
Syntax
expression.AddElement(oElement, nPos);
expression - A variable that represents a ApiInlineLvlSdt class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| oElement | Required | ParagraphContent | The document element which will be added at the position specified. Returns false if the type of oElement is not supported by an inline text content control. | |
| nPos | Optional | number | The position of the element where it will be added to the current inline text content control. If this value is not specified, then the element will be added to the end of the current inline text content control. |
Returns
boolean
Example
Add a run to the container in a document.
// How to add text run to the inline text element in a document.
// Add text to the inline control indicating the starting index in a document.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let inlineLvlSdt = Api.CreateInlineLvlSdt();
paragraph.AddInlineLvlSdt(inlineLvlSdt);
let run = Api.CreateRun();
run.AddText("This is an inline text content control with a text run in it.");
inlineLvlSdt.AddElement(run, 0);