Friday, April 16, 2010

VSTO Fun

It’s always fun when you get a challenging requirement. Today I had to implement a feature to create readonly word documents. First I was looking at using the Protect Document features to implement this functionality.

MarkAsFinal

But a colleague found that there is a simpler option available. You can mark a document as final. Doing this using  VSTO is nothing more then setting the Document.Final property to true. However, our journey wasn’t complete yet, because once you change this property to true a dialog box is shown to the user and I couldn’t get rid of it.

So in the end, I changed my implementation to use OpenXML and solved it by adding a CustomPropertiesPart to the WordDocument.

No comments: