Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Issue with OpenXml WmlComparer when comparing documents with different numbering styles, Bug with Open XML SDK #1634

Copy link
Copy link
Closed
@yatintripathi

Description

@yatintripathi
Issue body actions

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 :-
Screenshot (55)
Screenshot (57)

Microsoft Word's inherent working functionality :-
Screenshot (58)

OpenXML SDK WmlComparer working functionality :-
Screenshot (60)

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:

  1. Go to WORD.
  2. Click on Review Tab and click on compare and compare two word documents , one with Legal Numbering System and one without it and compare.
  3. You will see inherent working functionality of compare
  4. To generate Legal numbering in a word document
  5. Click on Multilevel list on the taskbar of word
  6. Click on Define new multilevel list
  7. Click on more
  8. On the right hand side you will see a check box of Legal Numbering Style
  9. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.