StructuredDocumentTagLockContentControl Property |
Namespace: Aspose.Words.Markup
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");