Optimize Document for MS Word 2016 Version & Reduce Generated DOCX File Size C# .NET

Hi…

I just put these instruction into our code and now the generated docx size bloated from 68KB
to about 2.7MB. This is way too big… .Is it possible for me to somehow reduce this size and retain the optimization for Word 2016 generation.

What we are trying to do is not have the docx generated in compatibility mode.
Thank you.

Aspose.Words.Document wordDoc = new Aspose.Words.Document(docStream);
wordDoc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2016)

@nick1234,

Thanks for your inquiry. Have you also tried the latest version of Aspose.Words for .NET i.e. 20.1 on your end? In case the problem still remains, please ZIP and upload your 68KB Word document and 2.7MB Word document here for testing. We will then investigate the issue on our end and provide you more information.

Also, do you still see the same problem when running the following code on your end?

Document doc = new Document("E:\\Temp\\64kb.docx");
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2016);

OoxmlSaveOptions opts = new OoxmlSaveOptions(SaveFormat.Docx);
opts.Compliance = OoxmlCompliance.Iso29500_2008_Transitional;

doc.Save("E:\\Temp\\20.1.docx", opts);

Does this save it in Word2016 ?
What is 2008 Transitional ? Please clarify… Thx

This removes the compatibilty mode issue… However, it bloats the size from 60KB to 3MB which is wayyy too big.

Is there an option to compress it ?

@nick1234,

Please refer to OoxmlSaveOptions Class.

As requested earlier, please ZIP and upload your 60KB Word document and 3MB Word document here for testing. We will then investigate the issue on our end and provide you more information.