AppendDocument Results in Corrupt Docx Output

Hi HDR Inc,

Thanks for your inquiry. I have tested the scenario with latest version of Aspose.Words (v13.1.0) and have not found any issue with AppendDocument method.

I have tested your application and get the corrupted document. You are sending document to client browser. In this case, you should simply add Response.End() after sending document to client browser. This will resolve the problem. When you save a Doc/Docx document to client browser, content of web page is added at the end of the document, you can see this if open your Doc/Docx document in any binary editor. That is why MS Word cannot open this document. If you add Response.End(), content of web page will not be added and document will be valid.

Hope this answers your query. Please let us know if you have any more queries.

Dim doc As New Aspose.Words.Document("....")
doc.Save(Response, "out.docx", Aspose.Words.ContentDisposition.Attachment, Nothing)
Response.End()

Hi Jeffrey,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.