TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

GetLock

GetLock() → { SdtLock }

Returns the lock type of the current container.

Parameters:

This method doesn't have any parameters.

Returns:

Type
SdtLock

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with the content lock set to it.");
oBlockLvlSdt.SetLock("sdtContentLocked");
oDocument.AddElement(0, oBlockLvlSdt);
var oLock = oBlockLvlSdt.GetLock();
var oParagraph = oDocument.GetElement(1);
oParagraph.AddText("Lock type: " + oLock);
builder.SaveFile("docx", "GetLock.docx");
builder.CloseFile();

Resulting document