StructuredDocumentTagLockContentControl Property

When set to true, this property will prohibit a user from deleting this SDT.

Namespace:  Aspose.Words.Markup
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public bool LockContentControl { get; set; }

Property Value

Type: Boolean
Examples
Shows how to restrict the editing of a StructuredDocumentTag.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
// It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
StructuredDocumentTag tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

// We can prohibit the users from editing the inner text in Microsoft Word by setting this to true
tag.LockContents = true;
builder.Write("The contents of this StructuredDocumentTag cannot be edited: ");
builder.InsertNode(tag);

tag = new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Inline);

// Setting this to true will disable the deletion of this StructuredDocumentTag
// by text editing operations in Microsoft Word
tag.LockContentControl = true;

builder.InsertParagraph();
builder.Write("This StructuredDocumentTag cannot be deleted but its contents can be edited: ");
builder.InsertNode(tag);

doc.Save(ArtifactsDir + "StructuredDocumentTag.Lock.docx");
See Also