Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Word-Based Samples
 Document Protector Sample
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0)
Document Protector Sample

Updated: November 2007

Note:

This sample runs only in Microsoft Office Word 2007.

This sample demonstrates how to protect a Word document and the document structure. The sample tool protects the entire document and then enables you to unprotect any or all bookmarks, form fields, and XML nodes that are in the document. You also have the option to password-protect the document.

Security Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

For information about how to install the sample project on your computer, see How to: Install and Use Sample Files Found in Help.

Download sample

To run the sample

  1. Press F5.

  2. On the File menu, click Open, and then browse to the document you want to protect.

  3. Select the items that you do not want to be protected.

  4. Optionally, you can assign a password to the document by clicking Password on the Protection menu.

  5. On the Protection menu, click Protect to apply the protection to the document.

  6. On the File menu, click Save to save your work.

  7. On the File menu, click Exit to exit the Document Protector sample tool.

A document that has Bookmark controls, form fields, or XMLNode controls.

The Document Protector sample tool protects the document and then enables you to select the types of items (XML nodes, form fields, or bookmarks) you want to make available for editing.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker