ApiInlineLvlSdt

new ApiInlineLvlSdt()

Class representing a container for the paragraph elements.

Methods

Name Description
AddComment

Adds a comment to the current inline content control. Please note that this inline content control must be in the document.

AddElement

Adds an element to the inline text content control.

AddText

Adds text to the current content control.

Copy

Creates a copy of an inline content control. Ignores comments, footnote references, complex fields.

Delete

Removes a content control and its content. If keepContent is true, the content is not deleted.

GetAlias

Returns the alias attribute for the current container.

GetClassType

Returns a type of the ApiInlineLvlSdt class.

GetDropdownList

Returns a list of values of the combo box / dropdown list content control.

GetElement

Returns an element of the current inline text content control using the position specified.

GetElementsCount

Returns a number of elements in the current inline text content control. The text content control is created with one text run present in it by default, so even without any element added this method will return the value of '1'.

GetLabel

Returns the label attribute for the current container.

GetLock

Returns the lock type of the current container.

GetParentContentControl

Returns a content control that contains the current content control.

GetParentParagraph

Returns a paragraph that contains the current content control.

GetParentTable

Returns a table that contains the current content control.

GetParentTableCell

Returns a table cell that contains the current content control.

GetPlaceholderText

Returns the placeholder text from the current inline content control.

GetRange

Returns a Range object that represents the part of the document contained in the specified content control.

GetTag

Returns the tag attribute for the current container.

IsForm

Checks if the content control is a form.

Push

Adds an element to the end of inline text content control.

RemoveAllElements

Removes all the elements from the current inline text content control.

RemoveElement

Removes an element using the position specified from the current inline text content control.

SetAlias

Sets the alias attribute to the current container.

SetLabel

Adds a string label to the current inline text content control.

SetLock

Sets the lock to the current inline text content control: "contentLocked" - content cannot be edited. "sdtContentLocked" - content cannot be edited and the container cannot be deleted. "sdtLocked" - the container cannot be deleted.

SetPlaceholderText

Sets the placeholder text to the current inline content control. Can't be set to checkbox or radio button

SetTag

Adds a string tag to the current inline text content control.

SetTextPr

Applies text settings to the content of the content control.

ToJSON

Converts the ApiInlineLvlSdt object into the JSON object.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oInlineLvlSdt = Api.CreateInlineLvlSdt();
var oRun = Api.CreateRun();
oRun.AddText("This is an inline text content control.");
oInlineLvlSdt.AddElement(oRun, 0);
var changeRun = oInlineLvlSdt.GetElement(0);
changeRun.SetBold(true);
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
oInlineLvlSdt.SetAlias("№1");
var oAlias = oInlineLvlSdt.GetAlias();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Alias: " + oAlias);
oDocument.Push(oParagraph);
oInlineLvlSdt.SetLabel("2147483647");
var oLabel = oInlineLvlSdt.GetLabel();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Label: " + oLabel);
oDocument.Push(oParagraph);
oInlineLvlSdt.SetTag("This is a tag");
var oTag = oInlineLvlSdt.GetTag();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Tag: " + oTag);
oDocument.Push(oParagraph);
oInlineLvlSdt.SetLock("contentLocked");
var oLock = oInlineLvlSdt.GetLock();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Lock type: " + oLock);
oDocument.Push(oParagraph);
var sClassType = oInlineLvlSdt.GetClassType();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class Type = " + sClassType);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "ApiInlineLvlSdt.docx");
builder.CloseFile();

Resulting document