Free Support Forum - aspose.com

Docx files loose their header and footer when Document.Protect is called

I have a word 2007 file with a .docx extension that I am calling Document.Protect() on.
The resulting document is missing the contents of it’s header and footer.

In Word if I save the source document as a word 97-2003 document (with a .doc extension) and try the call to Document.Protect() in aspose.words, it works fine.

It appears to me that there is an issue with protecting word 2007 documents.
Problematic document is attached.



Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You told that the problem occurs with DOCX file, but you have attached DOC file. I cannot reproduce the problem with this file on my side. I used the following code for testing:

Document doc = new Document(@"Test095\in.doc");

doc.Protect(ProtectionType.ReadOnly);

doc.Save(@"Test095\out.docx");

Could you please double check that you have attached correct file and provide me code example that will allow me to reproduce the problem on my side?

Best regards.

Oops, I attached the wrong document earlier.
This is the correct one…

Your code example above is exactly what I was attempting.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. But I still cannot reproduce the problem on my side. Which version of Aspose.Words are you using? To check version of the library, right click on the dll, select Properties from the context menu, then select Version tab. You will see File version.

I use the latest version of Aspose.Words (6.3.0) for testing.

Best regards.

Aspose.words.dll version 6.2.0.0 .net 1.1 version.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I still cannot reproduce the problem on my side. Please try using the latest version of Aspose.Words:

http://www.aspose.com/community/files/51/file-format-components/aspose.words-for-.net-and-java/entry172475.aspx

In addition, could you please create sample application that will allow me to reproduce the problem?

Best regards.

Ok, I discovered the way to reproduce the issue.

ONLY calling mailmerge on a document, saving the file, creating a new
aspose.words.document from the saved file (merged-test.docx) and protecting that document and saving it (protected-merged-test.docx) will
cause the issue.


Calling each method individually on the original document (test.docx) does not cause a problem.
Calling mailmerge and then protect on the same Aspose.Words.Document does not cause the problem.

I have attached an example console app source to reproduce the issue.
Note: I was using Aspose.Words.dll Version 6.3.0.0 for .net 1.1


Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem and created new issue #8686 in our defect database. I will notify you as soon as it is fixed.

Best regards.

The issues you have found earlier (filed as 8686) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.