![microsoft word remove all content controls microsoft word remove all content controls](https://i.pinimg.com/736x/06/bc/56/06bc565fdadcaa9f4652c001ef9a08c2.jpg)
To protect a content control at design time For more information, see How to: Add content controls to Word documents. In the document that is hosted in the Visual Studio designer, select the content control that you want to protect. In the Properties window, set one or both of the following properties: To prevent users from editing the control, set LockContents to True. To prevent users from deleting the control, set LockContentControl to True.
![microsoft word remove all content controls microsoft word remove all content controls](https://www.codeproject.com/KB/office/370758/dcc2_Doc-r-700.png)
Set the LockContents property of the content control to true to prevent users from editing the control, and set the LockContentControl property to true to prevent users from deleting the control. The following code example demonstrates using the LockContents and LockContentControl properties of two different RichTextContentControl objects in a document-level project. RichTextContentControl deletableControl To run this code, add the code to the ThisDocument class in your project, and call the AddProtectedContentControls method from the ThisDocument_Startup event handler. RichTextContentControl editableControl Private. RichTextContentControl Word.Range range1 = ĭeletableControl = (range1,ĭeletableControl.PlaceholderText = "You can delete this control, " + Private void AddProtectedContentControls() Private. RichTextContentControlĭim editableControl As. Private Sub AddProtectedContentControls() Word.Range range2 = ĮditableControl = (range2,ĮditableControl.PlaceholderText = "You can edit this control, " +ĮditableControl.LockContentControl = true ĭim deletableControl As.