开发者

make wordml readonly

开发者_开发技巧

how i caon make a wordml read-only from .

any ideas??


Adding the following to your WordML document will tell Word to treat its contents as read only:

<w:wordDocument>
  <w:docPr>
    <w:documentProtection w:edit="read-only" w:enforcement="on" w:unprotectPassword="5349CC3D"/>
  </w:docPr>
</w:wordDocument>

w:unprotectPassword is "1234" in this example but this attribute is not required. If an unlock password is not included Word will allow the user to just turn the read only state of the document off without challenging them.

Hope that helps and is what you are looking for!


if you are using the Open XML SDK 2.0 you can specify a file as read-only in the second parameter to the open method call:

// false is the read-only property
using (var wordprocessingDocument = WordprocessingDocument.Open(documentFileName, false))
{
     // Do work here            
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜