How to make a read-only paragraph with openxml
The practical (but not 100% safe) solution is to wrap your protected paragraph or paragraphs in a locked Rich Text content control, i.e., an instance of SdtBlock that is configured such that users can’t edit or delete the content control and its contents.
Here is some sample markup that shows a locked content control with a paragraph protected in this way and another paragraph outside of that content control.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:sdt>
<w:sdtPr>
<w:lock w:val="sdtContentLocked"/>
</w:sdtPr>
<w:sdtContent>
<w:p>
<w:r>
<w:t>protected paragraph</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
<w:p>
<w:r>
<w:t>unprotected paragraph</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
Take note of the w:lock element, which is represented by the Lock class in the Open XML SDK.
The C# code required to create the above w:sdt element is the following:
var sdt =
new SdtBlock(
new SdtProperties(
new Lock { Val = LockingValues.SdtContentLocked }),
new SdtContentBlock(
new Paragraph(
new Run(
new Text("protected paragraph")))));