Document Protection doesn’t seam to work for docx documents...
First I load up a blank docx document created with MS Office 2007.
string templatePath = this.MapPath("bin") + @"\..\templates\blank.docx";
Then I create the Document and Document builder classes…
Document doc = new Document(templatePath);
DocumentBuilder builder = new DocumentBuilder(doc);
Then I inserted some html using the DocumentBuilder classes InsertHTML method.
Then I used this code to lock the document:
Then I sent the document to the user with this code.
doc.Save("TestDocument.docx", SaveFormat.Docx, SaveType.OpenInWord, this.Response);
This I assume should lock the document. But when the document is brought up in word 2007 on the target system the document is locked and can’t be modified initially. But if the “Stop Protection” button is pressed it just unlocks the document, It never asks for a password and the user can edit the document with no problems.
Have I done something wrong?
I have attached a sample document...