Words 2013 docx format

I’m having an issue regarding saving into the 2013 docx format. As far as I can tell, according to aspose the 2013 docx format is supported, but when I open a document generated by aspose and saved as a docx in office 2013 it still shows as being open in compatibility mode and asks when saving this document if I want to upgrade it to the latest format.

As for why I want it in the latest format, outside of not wanting it to show compatibility mode and having to do special work to maintain that setting when saving, the right margin indents move after saving in the latest version.

Attached is the document aspose is generating (Straight Save.docx) and then after I save in the latest version as according to word, (Latest Version.docx)

I am saving using this code:

var memoryStream = new MemoryStream();

GeneratedComponent.Save(memoryStream, SaveFormat.Docx);

and then storing memoryStream.ToArray() in a database, from which it is later streamed through a webservice. I also checked saving the file directly to the disk and it had the same results.

How do I specify saving in the latest MS Word 2013 Format?

Hi Ben,

Thanks for your inquiry. Please use CompatibilityOptions.OptimizeFor method as shown below to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2013);
doc.Save(MyDir + "out.docx");

Thank you Tahir.

Putting in that line of code did fix the indent issue I was experiencing, but it did not fix the compatibility issue, the ribbon still showed. After looking more into the optimize for method, it said I might also need to set the Compliance property in the OoxmlSaveOptions class, and after adding those as save options and specifying the Compliance property as OoxmlCompliance.Iso29500_2008_Transitional that got rid of the ribbon.

I have a follow up question. On this page: https://reference.aspose.com/words/net/aspose.words.settings/compatibilityoptions/optimizefor/ it says that I may need to set the compliance property to Iso29500_2008_Transitional or higher, but I only see two options in the OoxmlCompliance enum. What does it mean by higher?

Hi Ben,

Thanks for your inquiry.

The strict compliance level is higher than transitional. You are using Word 2013 documents. We suggest you please use Iso29500_2008_Strict compliance level. Hope this helps you.