Articles in this section
Category / Section

Why is the ZIP exception thrown when processing Word document in DocIO

3 mins read

Syncfusion® Essential® DocIO is a .NET Word library, which throws a ZIP exception when processing a zero-byte size Word document.

Why is the ZIP exception thrown?

A Word document might be created by using the shortcut menu (Right click > Microsoft Word Document) instead of using the Microsoft Word application. When creating a Word document using the shortcut menu, the internal file structure (structure of the complete Word document) will not be created, resulting in a file size of 0 bytes, as illustrated below:

1. Right click > Microsoft Word document

Screenshot of shortcut menu to create Word document
2. You can see the generated Word document is 0 bytes as in the following screenshot.

Screenshot of file size of Word document


There is no internal file structure while creating the Word document as per above approach. So, loading this empty Word document using Essential® DocIO throws Zip exception (“Zip exception. Can't locate end of central directory record. Possible wrong file format or archive is corrupt.”).

The internal file structure can be created on the following scenarios only:

  1. Always created, if the Word document is created using Microsoft Word application.
  2. When creating Word document by right clicking the shortcut menu, insert any content in the Word document, then only its internal file structure is created. Otherwise, it does not have internal structure (0 bytes file size).

How to resolve this problem

To resolve this exception, create a Word document using the Microsoft Word application or programmatically using Essential® DocIO. If you are using any other Word applications to create a Word document, ensure it is created with a valid internal structure to resolve this problem on your side.

Note:

Starting with v16.2.0.x, if you reference Syncfusion® assemblies from a trial setup or from the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion® license key in your application to use the components without a trial message.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied