This project has moved. For the latest updates, please go here.

Reading file .doc with DOCX gives Error

Nov 3, 2012 at 7:21 AM
Edited Nov 3, 2012 at 7:23 AM

When I am trying to read file with .doc extension

that is  DocX document= DocX.Load("D:\example.doc");

that is gives me error "File is corrupted".

Any help is greatly appreciated.

Nov 8, 2012 at 11:08 AM

Word documents that are saved in the earlier .doc format are not XML compliant so will not open using the novacode.docx application. The Word .docx file format is completely different from the word .doc.

 

I would suggest another reader application or using the bad practice interops instead. Or of course telling your users to save as .docx instead... This isn't a bad idea since Microsoft Office 2003 is being made unsupported (no more security fixes/patches etc) so it's life span is ending next year. Office 2007+ can all save in the XML compliant format by default.

Marked as answer by MadBoy on 6/3/2014 at 3:22 AM
May 21, 2014 at 4:56 AM
I have a mistake if I use statement

DocX document = DocX.Load("C:\10. Trustee Declaration.docx");

the first "\" is marked with unrecognised escape sequence.

how to do you request it correctly?
May 21, 2014 at 8:27 AM
I figured it out: either use @ or double the \ in the path