Get Started
Usage API
More information

ApiInlineLvlSdt

new ApiInlineLvlSdt()

Class representing a container for the paragraph elements.

Methods

Name Description
AddElement

Add an element to the inline text content control.

AddText

Add text to the current content control.

Copy

Create a copy of an inline content control. Ingonore comments, footnote references, complex fields.

Delete

Remove content control and content. If keepContent is true, the content is not deleted.

GetAlias

Get the alias attribute for this container.

GetClassType

Get the type of this class.

GetElement

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

GetElementsCount

Get the 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

Get the label attribute for this container.

GetLock

Get the lock type of this container.

GetParentContentControl

Get the content control that contains the current content control.

GetParentTable

Get the table that contains the content control.

GetParentTableCell

Get the table cell that contains the content control.

GetRange

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

GetTag

Get the tag attribute for this container.

Push

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

RemoveAllElements

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

RemoveElement

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

SetAlias

Set the alias attribute for this container.

SetLabel

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

SetLock

Set the lock to the current inline text content control. "contentLocked" - content cannot be edited. "sdtContentLocked" - content cannot be edited and BlockLvlSdt cannot be deleted. "sdtLocked" - BlockLvlSdt cannot be deleted.

SetTag

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

SetTextPr

Apply text settings to content of content control.

Example

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

Resulting document