eclipse-platform / eclipse-platform/eclipse.platform

Compare with Microsoft Word 2007 and above diffs in direction opposite to Word 2003

Offen
#65 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
165
Forks
174
Ø Merge
2 T. 8 Std.
Gemergte PRs (30 T.)
22

Beschreibung

This is a fresh copy of the old [bug 401373](https://bugs.eclipse.org/bugs/show_bug.cgi?id=401373), after doing some intensive research & debugging today.

The fix seems to be pretty easy: as hinted in the linked report, it is just about switching the compared Document objects order based on the Word version, like they did it back in 2008 in TortoiseSVN:

TortoiseGit/tortoisesvn@0dabda7d91c41c085986a150afc1a368e154f102, or just look for occurrences of `vOffice2007` in their [diff-doc.js](https://github.com/TortoiseGit/tortoisesvn/blob/master/contrib/diff-scripts/diff-doc.js).

=> We can probably do something similar inside the `org.eclipse.compare.internal.win32.WordComparison.createWorkingCopy(String baseDocument, String revisedDocument, String workingCopy)` method.

We just need to get to `Word.Version` somehow, in order to implement the switch condition for backwards compatibility. The following looks like the simplest working way (possibly returning string `12.0` for Word 2007):

```java
getVariantProperty(new OleAutomation(new OleClientSite(frame, SWT.NONE, "Word.Application")), "Version")
```

_Trivia: The reported problem is technically already 14 years old, as the comparison feature, relying on pre-2007 Word versions, was implemented back in 2008. And it looks like an undocumented change in the Microsoft's [_Document.Compare()](https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word._document.compare?view=word-pia) method._

**UPDATE:** Unfortunately, the problem seems to be hidden more in the core "comparison logic" which is inconsistent across the GUI. See e.g. [bug 516450](https://bugs.eclipse.org/bugs/show_bug.cgi?id=516450) for more details. For this bug, this means that it is quite possible that the diff is currently displayed incorrectly e.g. **just when comparing file versions from the History view** ("Compare with each other"). And this is caused by passing "left" and "right" versions into the Word comparator in different order from various GUI actions.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne bei org.eclipse.compare.internal.win32.WordComparison.createWorkingCopy(String baseDocument, String revisedDocument, String workingCopy), und untersuche anschließend die GUI-Pfade, die die linken und rechten Versionen an den Word-Vergleicher übergeben. Vergleiche das bestehende Verhalten mit TortoiseSVN's diff-doc.js und bug 516450; abgeschlossen ist die Arbeit, wenn die betroffenen Vergleichsaktionen über alle Word-Versionen hinweg die korrekte Reihenfolge verwenden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
desktop
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.