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

Free Support Forum - aspose.com

Saving with Aspose.Words results in a corrupt document

Dear Aspose team,

we have a .docx file which opens fine with Microsoft Word 2016. Loading it with Aspose.Words and trying to resave it results in a corrupted document. Office opens it in protected view, with the following message:
“Office has detected a problem with this file. Editing it may harm your computer.”

Used code:
Aspose.Words.Document doc = new Aspose.Words.Document(inputFilePath);
doc.Save(outputFilePath);

Problematic file: problematicFile.zip (24.1 KB)
Error message: warningMessage.png (41.4 KB)

Could you check out this issue?

Best regards,

Gergely Vándor
[BUG-722]

@gergelyv

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 18.10 and have not found the shared issue. Please use Aspose.Words for .NET 18.10. We have attached the output document with this post for your kind reference. 18.10.zip (25.3 KB)

We suggest you please use CompatibilityOptions.OptimizeFor method as shown below. Hope this helps you.

Document doc = new Document(MyDir + "exported.docx");
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2016);
doc.Save(MyDir + "18.10.docx");