Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am try to read doc file using WordprocessingDocument

But got an error like

File contains corrupted data.

My code

string filepath = @"\\...116.27.DOC";
WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(filepath , true);//error line here
Posted

1 solution

As far as I know, WordprocessingDocument[^] is only made to handle new .docx (openxml) format.
I'm afraid it is not compatible with older .doc (binary) format. This seems to be your issue: you are trying to open a file format that this object is not able to handle.

You should try to convert your document to a .docx one, and test it against your code.

Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900