我正在通过其标签从 docx 读取内容控件。我想阻止访问它(用户将无法编辑内容)。我怎样才能做到这一点?这是我从 docx 文档中通过其标签名称获取控制权的代码:
using (WordprocessingDocument wordDocTarget = WordprocessingDocument.Open(targetFilePath, true))
{
MainDocumentPart mainPartSource = wordDocSource.MainDocumentPart;
SdtBlock sdtBlock = mainPartSource.Document.Body.Descendants<SdtBlock>().Where(r => r.SdtProperties.GetFirstChild<Tag>().Val == "myTagName").SingleOrDefault();
// rest of my code (editing inner text)
}