SetLock
function SetLock(sLockType: contentLocked | sdtContentLocked | sdtLocked = null): void
Description
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.
Parameters
- sLockType
contentLocked | sdtContentLocked | sdtLocked
null The lock type applied to the inline text content control.
Returns
void
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oInlineLvlSdt = Api.CreateInlineLvlSdt();
oParagraph.AddInlineLvlSdt(oInlineLvlSdt);
var 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);
var sLock = oInlineLvlSdt.GetLock();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Lock type: " + sLock);
oDocument.Push(oParagraph);