none
Trying to open word document throws InvalidDataException RRS feed

  • Question

  • I'm trying to open a .doc file using OpenXML and I am getting the following error:

    System.IO.InvalidDataException: 'Number of entries expected in End Of Central Directory does not correspond to number of entries in Central Directory.'
    

    My code is really simple...

    var filePath = "C:\\[Rest-Of-Path]\\file.doc"
    var wordDocument = WordprocessingDocument.Open(filePath, false);
    

    What could be causing this error? Thanks!

    Friday, August 7, 2020 5:17 PM

All replies

  • Ok, so now I've realized that openxml is only compatible with .docx files and not .doc files. Are there any suggestions for how to go about reading data from older MS Word documents?
    Friday, August 7, 2020 5:44 PM