Formatting issue when opening a document

The document is protected with the Protect method with change tracking in the TrackChange mode.
After opening the document and removing protection, the document is edited and the formatting changes.
How can I perform this procedure myself (couldn’t find the suitable method; JoinRunsWithSameFormatting did not work either)?

In perspective, they get in the way when comparing documents using the Compare method.

Thanks!

@Ar_Tee,

Thanks for your inquiry. Could you please share some more detail about your query along with input and expected output documents? We will then provide you more information on this along with code.

Unfortunately, it is not possible to depersonalize the document to attach it as an example
But I’ll try to describe the situation:

  1. The document is structured in form of a table with two columns.
  2. At the bottom a one-column table is added with the signers details.
  3. Visually, no changes are made to the tables (2)
  4. The structure shows that the table changes its position in the global document table. It is performed as deletion and insertion of the same text in revisions, which hinder using the Compare method.
  5. In different documents, it the table can be moved to the higher-level row, to the previous row or paragraph.
  6. “Accept all revision” is not always possible, it seems to work only when the document is opened (in MS Word). And still affects the comparison.

@Ar_Tee,

Thanks for sharing the detail. Unfortunately, your question isn’t clear enough therefore we request you to please elaborate your inquiry further. Are you facing formatting issue after comparing the document using Aspose.Words?

Could you please share what issue you are facing when you open the document in MS Word?

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please share the screenshots of problematic section of output document.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Tahir, thank you.
We discovered that it’s сompatibility issue.

How can I transformate any docx document as MS Word 2016 or 2013 document?
SaveFormat method doesn’t work for our case.

@Ar_Tee,

Thanks for your inquiry. The CompatibilityOptions.OptimizeFor method allows to optimize the document contents as well as default Aspose.Words behavior to a particular versions of MS Word. Please use this method to prevent MS Word from displaying “Compatibility mode” ribbon upon document loading. Moreover, please set the OoxmlCompliance as Iso29500_2008_Strict to get the desired behavior.

Please use the following code example. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");

OoxmlSaveOptions options = new OoxmlSaveOptions();
options.Compliance = OoxmlCompliance.Iso29500_2008_Strict;
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2016);  

doc.Save(MyDir + "output.docx", options);