Docx is corrupt

Hello,

when I generate a docx file it reports this error:

The Office Open XML file .... cannot be opened bacause there are problems with the contents.

Details: The file is corrupt and cannot be opened.

When I change the format to .doc, there is no error.

I am using the latest version of Aspose.Words 13.3.0.0

I have attached the project.

Thanks for help

Libor

I have resolved now by using Response.End after the .save method.

Strange, that this is not needed when using .doc. It's required only for .docx.

Regards

Libor

Hi Libor,


Thanks for your inquiry. This is actually not an issue in Aspose.Words. You can resolve the problem with DOCX by simply adding Response.End() after sending document to client browser. For some reasons, when you save a DOCX document to client browser, content of web page is added at the end of the document, you can see this if you open your DOCX document in any binary editor. That is why Microsoft Word cannot open this document. If you add Response.End(), content of web page will not be added and document will be valid. It’s great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,