I am trying to open password-protected OpenOffice documents; I’ve tried both odt (and ods in the case of Cells). In the case of odt, the following exception is thrown by the Document constructor:
hexadecimal value 0x1B, is an invalid character. Line 2, position 1.
It’s a simple file, and the same file, unprotected, has no issue.
I’ve noticed the MS Office 2007 also cannot open these documents.
Is there a general inability to open password-protected OpenOffice documents?
Thanks for your request. Unfortunately, Aspose.Words does not support loading encrypted ODT document yet. Your request has been linked to the appropriate issue. We will let you know once it is resolved.
It is to inform you that starting from the 18.4 versions, you can use Aspose.Words for .NET and Aspose.Words for Java APIs to work with Password-Protected ODT and OTT file formats.
Please use the following code to load an encrypted ODT file in Aspose.Words’ Document object:
Document doc = new Document(@"\encrypted.odt", new LoadOptions("password"));
Please use the following code to save to ODT format and encrypt ODF with a password.
Document doc = new Document(); doc.Save(@"\encryped.odt", new OdtSaveOptions("password"));
And to detect or verify if an ODT document is encrypted with password or not, please use the following code:
FileFormatInfo info = FileFormatUtil.DetectFileFormat(@"\encryped.odt"); Console.WriteLine(info.IsEncrypted);