ReplaceByElement
Replaces the current content control with a new element.
Syntax
expression.ReplaceByElement(oElement);
expression
- A variable that represents a ApiBlockLvlSdt class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
oElement | Required | DocumentElement | The element to replace the current content control with. |
Returns
boolean
Example
This example replaces the content control with a paragraph.
let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
doc.AddElement(0, blockLvlSdt);
blockLvlSdt.SetPlaceholderText("Name");
let paragraph = Api.CreateParagraph();
paragraph.AddText("The content control was replaced with the current paragraph.");
blockLvlSdt.ReplaceByElement(paragraph);