Password protected docx

Technical support for Spire.Doc

Moderator: iceblue support

Password protected docx

Postby markowens » Wed May 30, 2012 11:39 am


I was trying to convert a simple password protected docx to pdf.

I tried to load the file via a stream (which works with non password protected passwords).
I get the following errors:

poDocx = new Spire.Doc.Document(poMemoryDocX, Spire.Doc.FileFormat.Docx, "open");
gives "Zip exception.Can't locate end of central directory record. Possible wrong file format or archive is corrupt."

poDocx = new Spire.Doc.Document(poMemoryDocX, Spire.Doc.FileFormat.Auto, "open");
gives "A disk error occurred during a write operation. (Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT))"

NB: The attached doc has an open password of 'open' and a modify password of 'edit'.


You do not have the required permissions to view the files attached to this post.
Posts: 24
Joined: Mon Mar 14, 2011 3:20 pm

Re: Password protected docx

Postby guestbook » Thu May 31, 2012 7:46 am

Hi Mark,

Thank you for reporting this bug. We have started research on it and will inform you once it is fixed. In order to solve the temporary inconvenience, we recommend a perfect workaround for you. In the workaround methods, I load word document from files in folder. The following code is what I used in the workaround, please have a try.

Code: Select all
using Spire.Doc;

namespace Support_504
    class Program
        static void Main(string[] args)
            string fileName = @"..\..\PasswordProtected.docx";
            Document doc = new Spire.Doc.Document(fileName, Spire.Doc.FileFormat.Docx, "open");
            //Document doc = new Spire.Doc.Document(fileName, Spire.Doc.FileFormat.Auto, "open");
            doc.SaveToFile("Sample.pdf", FileFormat.PDF);

        private static void PdfViewer(string fileName)
            catch { }

For any doubt, please feel free to contact me at any time. Have a nice day.

Best Regards

e-iceblue support
You do not have the required permissions to view the files attached to this post.
Posts: 2
Joined: Tue May 01, 2012 10:36 am

Re: Password protected docx

Postby nancy » Thu Jun 07, 2012 9:38 am

Hi Mark,

We have fixed the bug. Please download the new hotfix version v4.3.3:

If you have any problems, please contact me!
Best wishes to you! Happy work!
e-iceblue support
e-iceblue support team
User avatar
Posts: 51
Joined: Wed May 30, 2012 2:02 am

Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 0 guests