We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error when doc.Save(docx- SaveFormat.Docx- SaveType.OpenInBrowser- this.Response);

I got this error message when openning a docx file

"The Office Open XML file cannot be opened because there are problems with the contents:

Details: The file is corrupt and cannot be opened."

I use

doc.Save(docx, SaveFormat.Docx, SaveType.OpenInBrowser, this.Response);

to save the docx and send it to the browser

If I change the above code to

doc.Save(docxPath, SaveFormat.Docx);

and then open from the folder it will work.

Have I done anything wrong? Thanks.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think that you should call Respons.End() after saving document. Please try using the following code.

Document doc = new Document(Server.MapPath("in.docx"));

doc.Save("out.docx", SaveFormat.Docx, SaveType.OpenInWord, Response);


Hope this helps.

Best regards.

Was just looking into the same problem and the suggested fix worked, thanks guys!