JG Vimalan's Blog

It is all about coding!

Make word document uneditable using C#

This is continuation to my last post on dynamically adding rows to table in word document. The post can be found here, https://jgvimalan.wordpress.com/2011/02/08/add-rows-to-table-in-ms-word-document-using-c/

I got a task where, the dynamically generated word document has to be made uneditable. Inorder to achieve that, you need to protect the document by allow only reading. The sample code snippet is given below,

var wordApp = new ApplicationClass();

wordApp.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyReading, ref missing, ref missing, ref missing, ref missing);

This will make the word document uneditable.


February 12, 2011 - Posted by | ASP.NET, C#.NET

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: