Get Started
Documentation

SetLock

SetLock(sLockType)

Set the lock to the current inline text content control: either locks the content from editing, or from deleting the control, or both.

Parameters:

Name Type Description
sLockType SdtLock

The type of the lock applied to the inline text content control.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oRun;
oParagraph = oDocument.GetElement(0);
oInlineLvlSdt = Api.CreateInlineLvlSdt();
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
oRun = Api.CreateRun();
oRun.AddText("This is an inline text content control with the content lock set to it.");
oInlineLvlSdt.SetLock("sdtContentLocked");
oInlineLvlSdt.AddElement(oRun, 0);
builder.SaveFile("docx", "SetLock.docx");
builder.CloseFile();

Resulting document