Headers and footers dissapear when WmlComparer.Compare

Home Forums Open-Xml-PowerTools Headers and footers dissapear when WmlComparer.Compare

This topic contains 2 replies, has 2 voices, and was last updated by  aTrenea 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #4236


    Hello, I recently started using the open xml power tools to be able to compare 2 docm documents. But for some reason whenever i use it the headers and footers disappear . Is this a limitation of the comparer or am i doing something wrong?

    My code is a pretty basic one:

    WmlDocument originalWml = new WmlDocument(@”C:\backup\standard(1).docm”);
    WmlDocument originalWml2 = new WmlDocument(@”C:\backup\standard(2).docm”);

    var rez = WmlComparer.Compare(originalWml, originalWml2, new WmlComparerSettings());

    I any case is there a workaround for this?

    thank you for your time


    Eric White


    Yes, this is a limitation of WmlComparer. I implemented WmlComparer for a specific customer who had a specific need, and they did not require that WmlComparer deal with headers and footers.

    If you think about it, it is not so simple. Of course, you have the situation where a header or footer contains differences, and would need to compare them, and include revision marks in them. But it gets more complicated than that – what if one document has a section break, and the other does not – then this needs to get recorded properly. If one document contains the property – keep the same header footer as the previous section, whereas the other document contains newly defined headers / footers, then this needs to get properly recorded. There are other edge cases in addition to these.

    The main goal of WmlComparer was to compare the actual content of the documents themselves, where the content was defined as not being the headers/footers. The estimate to properly handle headers/footers was significantly higher, the customer did not need it, so the feature to consider headers/footers was cut, so WmlComparer does not include headers/footers in the new document.

    I am just about to embark on a significant revision of WmlComparer. I am going to add ability to handle nested tables and text boxes, so I will consider again if there is some good option for sections/headers/footers. However, once again, the requirement is not there to handle headers/footers, so I probably cannot spend much time on it.

    Best, Eric



    Hello Eric, Thank you very much for the response. I will search for a different solution then.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.