Compare RTF Text Custom Plugin #3475
GeorgeLelik
started this conversation in
Ideas
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Some time ago I was discussing with a colleague the alternatives to CompareMSWordFiles to compare .rtf documents. The issue with CompareMSWordFiles was that it is a bit slow I guess in part because it requires to convert .rtf to .docx; and that it reports each column on successive lines -- the latter may help to more precisely identify the differences but makes the diff window hard to read i.e., takes a bit to understand which column each line belongs to.
The result of this discussion, having failed to find any such plugin or options settings for the existing ones, was the following custom plugin below (using a quick AI with a source linked below).
To note, it works for our intended purpose (.rtf documents made of tables) but I have not tested it across other scenarios. It may be adapted to work with .docx documents too, for a quicker alternative to CompareMSWordFiles, but we have not had such need so I did not explore it. The WinMerge Version used was 2.16.46.0.
It was suggested that I share it here in case others find it helpful too.
Creating CompareRTFText Custom WinMerge Plugin
1.1) Open WinMerge application and go to Plugins > Plugin Settings... > Add > Add unpacker plugin...; set options as follows:
Plugin type: File Unpacker
Plugin name: CompareRTFText
Extension list:
\.rtf$Description:
Author : Georgy Soloveychik
Default arguments:
Category: &Others
Menu caption: CompareRTFText
Window type:
Unpacked file extension:
Enable automatic unpacking/prediffing for the plugin: Check
Require arguments: Uncheck
Generate editor script: Uncheck
command line (UnpackFile):
powershell "Add-Type -AssemblyName System.Windows.Forms; $rtBox = New-Object System.Windows.Forms.RichTextBox; $rtBox.Rtf = [System.IO.File]::ReadAllText('${SRC_FILE}'); $plainText = $rtBox.Text; [System.IO.File]::WriteAllText('${DST_FILE}', $plainText, [System.Text.Encoding]::UTF8)"1.2) Press OK
1.3) Back in Plugins menu, find CompareRTFText; set options as follows:
File filters:
\.rtf$Plugin arguments:
Enable automatic unpacking/prediffing for the plugin: Check
1.4) Press OK
1.5) Go to Plugins > Reload plugins or restart WinMerge application
Note: this custom plugin may not work on .rtf documents which combine both tables and figures
Custom Delimiter-Separated Values
File Patters: *.rtf
Delimiter Character: \t
All reactions