We have Microsoft Word Table Formatting Issues with OOXML Specification using .NET
When we save some documents with OoxmlSaveOptions, the table layout present in them is different then when saved without the options.
Please see the code example and the sample document to replicate the issues.
Code to Reproduce Microsoft Word Table Formatting Issues
var doc = new Document(@"out.docx");
var options = new OoxmlSaveOptions { Compliance = OoxmlCompliance.Iso29500_2008_Strict };
doc.Save(@"outAfterOoxml.docx", options);
Please note that Aspose.Words mimics the behavior of MS Word. If you convert the document to strict compliance level using MS Word, you will get the same output. Please check the attached image for detail. strict compliance.png (32.8 KB)
The document you are using is created by old version of MS Word i.e. 2007. So, when you view it later versions of MS Word, the document will be opened in compatibility mode. To avoid compatibility issues, you need to save the document with OoxmlCompliance.Iso29500_2008_Strict compliance.
Can you tell me how I can check whether a document was created by an old version of MS Word?
Is there any way to check it programmatically with Aspose.Words?
Thanks,
Lukasz
The BuiltInDocumentProperties.Version is related to AppVersion property in app.xml and MS Word does not allow to change it. This property represents the version number of the application that created the document. Following are the version numbers for MS Word.
11.0000 = Word 2003
12.0000 = Word 2007
14.0000 = Word 2010
15.0000 = Word 2013
16.0000 = Word 2016
Please use BuiltInDocumentProperties.Version property as shown below to get the desired output.
I have checked BuiltInDocumentProperties.Version for the following documents:
input.docx (from the other ticket) - version 16 - Compliance - Iso29500_2008_Transitional
out.docx (from this ticket) - version 16 - word 2016 - Compliance - Ecma376_2006
new Document()(object created with Aspose.Words - version 11 - word 2016 - Compliance - Ecma376_2006
Does it mean that we need to save documents that come with Iso29500_2008_Transitional Compliance as Iso29500_2008_Strict instead? And leave all other with Ecma376_2006 compliance? How would you recommend approaching the issues we are seeing in the two tickets?
You also mentioned here: “The document you are using is created by old version of MS Word i.e. 2007.” - how did you find it? I have checked the version and it is Word 2016.
By default, Aspose.Words saves the DOCX with Ecma376_2006 compliance.
By default, Aspose.Words uses MS Word 2007 empty document template for new Document().
You need to save the document according to your required compliance level. If you are using newer versions of MS Word to view the documents, we suggest you please use Iso29500_2008_Strict compliance.
You can use following line of code to find the version of MS Word that created the document.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.