跳到主要内容

GetPlaceholderText

Returns the placeholder text from the current inline content control.

Syntax

expression.GetPlaceholderText();

expression - A variable that represents a ApiInlineLvlSdt class.

Parameters

This method doesn't have any parameters.

Returns

string

Example

This example shows how to get the placeholder text from the content control.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let inlineLvlSdt = Api.CreateInlineLvlSdt();
inlineLvlSdt.SetPlaceholderText("Enter your text here");
paragraph.AddInlineLvlSdt(inlineLvlSdt);
let placeholderText = inlineLvlSdt.GetPlaceholderText();
paragraph = Api.CreateParagraph();
paragraph.AddText("Placeholder text: " + placeholderText);
doc.Push(paragraph);