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
Replace the content control with a paragraph in a document.
// Create the block-level content control object and replace it with the paragraph object in a document.
// Replace the block level content control with a text in a document.
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);