Get Started
Usage API

GetLock

GetLock() → { SdtLock }

Get the lock type of this container

Parameters:

This method doesn't have any parameters.

Returns:

Type
SdtLock

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 with the content lock set to it.");
oInlineLvlSdt.AddElement(oRun, 0);
oInlineLvlSdt.SetLock("sdtContentLocked");
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
oLock = oInlineLvlSdt.GetLock();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Lock type: " + oLock);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "GetLock.docx");
builder.CloseFile();

Resulting document