Description
Describe the bug
I'm currently using the OpenXml library in C# to compare two Word documents utilizing the WmlComparer.Compare method. The comparison works well in most cases, but I'm encountering an issue specifically related to legal style numbering.
When comparing two documents, if one contains legal style numbering and the other doesn't, the resulting compared document loses the legal numbering entirely, without even maintaining a strikethrough format.
I've already implemented the comparison using WmlComparer.Compare and set the necessary comparison settings. However, I'm struggling to retain the legal style numbering or apply strikethrough formatting to the mismatched numbering when generating the compared document.
For more Reference :- [(https://stackoverflow.com/questions/77697178/issue-with-openxml-wmlcomparer-when-comparing-documents-with-different-numbering?noredirect=1#comment136981416_77697178)]
Screenshots
These are how the documents look :-
Microsoft Word's inherent working functionality :-
OpenXML SDK WmlComparer working functionality :-
Yo will see differences between Microsoft Word's inherent working functionality and OpenXML SDK WmlComparer working functionality.
To Reproduce
Create two docs in similar manner as in the screenshots of how the documents look and compare it via WmlComparer code you will be able to reproduce the Observed behavior and to reproduce the Expected behavior compare the two docs via compare functionality that word provides.
Steps to Reproduce the behavior:
- Go to WORD.
- Click on Review Tab and click on compare and compare two word documents , one with Legal Numbering System and one without it and compare.
- You will see inherent working functionality of compare
- To generate Legal numbering in a word document
- Click on Multilevel list on the taskbar of word
- Click on Define new multilevel list
- Click on more
- On the right hand side you will see a check box of Legal Numbering Style
- Check it and press OK.
Observed behavior
As you can see from the screenshot above "OpenXML SDK WmlComparer working functionality" legal numbering is not retained.
Expected behavior
As you can see from the screenshot above "Microsoft Word's inherent working functionality" legal numbering is retained.
Desktop (please complete the following information):
- OS: Windows
- Office version : Version 2311 (Build 17029.20108)
- .NET Target: .NET Core Version 7.0.102
- DocumentFormat.OpenXml Version: 2.20.0
- OpenXMLPowerTools Version : 4.5.3.2
Below is the code :-
WmlComparerSettings settings = new WmlComparerSettings
{
AuthorForRevisions = author,
DetailThreshold = 0
};
var originalDoc = new WmlDocument(originalPath.ToString());
var revisedDoc = new WmlDocument(revisedPath.ToString());
WmlDocument comparedDoc = WmlComparer.Compare(originalDoc, revisedDoc, settings);
@EricWhiteDev
@ThomasBarnekow
@twsouthwick
@tomjebo @mikeebowen @hunyu @AlfredHellstern @lindexi