Read-Only Office Viewer for Word, Excel and PowerPoint

Read-Only Office Protection

Office Viewer Component allows developers to protect Word document and Excel from unauthorized changes. You can protect a form to prevent users from making changes as they fill it out. A form contains two types of content: form fields (form field: In a form, a location where a particular type of data, such as a name or address, is stored.), such as check boxes, and display content, such as text that labels a check box or instructions for filling out the form. People can use the form fields to fill out the form, but they should not be able to change the display content. You can allow comments or tracked changes only for your word document. The protected document can't modify the text content or change the format. The toolbar will be disabled.

Download Office Viewer Component and View Sample Projects

Protect Method

boolean ProtectDoc(long ProtectType, [in, optional] VARIANT Password)

Helps to protect the specified document from changes. When a document is protected, users can make only limited changes, such as adding annotations, making revisions, or completing a form.

ProtectType: The protection type for the specified document.
Password: Optional Object. The password required to remove protection from the specified document.

Protect word document from unauthorized changes

The ProtectionType for the word document can be one of the follow values.

enum WdProtectType
{
wdAllowOnlyRevisions = 0,
wdAllowOnlyComments = 1,
wdAllowOnlyFormFields = 2,
wdAllowOnlyReading = 3,
wdNoProtection = -1,
}WdProtectType;

For Example:

The following vbscript shows how to protect a document for only revisions.

Sub ProtectDoc_Example()
EDOffice.ProtectDoc wdAllowOnlyRevisions
End Sub

You can add the above code at the DocumentOpened event.

Protect Excel

Microsoft Excel provides several layers of security and protection to control who can access and change your Excel data. For optimal security, you should protect your entire workbook file with a password, allowing only authorized users to view or modify your data.

For additional protection of specific data, you can protect certain worksheet or workbook elements. Use element protection to help prevent anyone from accidentally or deliberately changing, moving, or deleting important data.

The ProtectionType for the Excel document can be one of the follow values.

typedef enum XlProtectType
{
XlProtectTypeNormal = 0x00000001,
XlProtectTypeWindow = 0x00000002,
XlProtectTypeStruct = 0x00000004,
XlProtectTypeDrawingObjects = 0x00000010,
XlProtectTypeContents = 0x00000020,
XlProtectTypeScenarios = 0x00000040,
XlProtectTypeUserInterfaceOnly = 0x00000080,
}XlProtectType;

Example

The following vbscript shows how to protect Excel workbook.

Sub ProtectDoc_Example()
EDOffice.ProtectDoc XlProtectTypeNormal|XlProtectTypeWindow|XlProtectTypeStruct
End Sub

You can lock the structure of a workbook, which prevents users from adding or deleting worksheets or from displaying hidden worksheets. You can also prevent users from changing the size or position of worksheet windows. Workbook structure and window protection applies to the entire workbook.

Cancel Word and Excel Protection

boolean UnProtectDoc([in, optional] VARIANT Password);

Removes protection from the specified document. If the document isn't protected, this method generates an error.
Password: Optional Object. The password required to remove protection from the specified document.

Example

The following vbscript shows how to unprotect a document with password 832-f2322.

Sub Unprotect_Example()
EDOffice.UnProtectDoc "832-f2322"
End Sub

Disable MS Word Shortcut Hot Key

Disables MS Word Standard Command

Disable Office Ribbon Button

Show/Hide Office Menu Bar

Free Download Office Viewer Component and View Sample Projects

Free Download Office Viewer Component

Products   |  Download   |  Buy Now   |  Diagram Software   |  Shapes   |  Help Index   |  Site Map
Copyright EdrawSoft 2004-2012; All Rights Reserved.