Bug 93891 - Add compare documents to command line interface
Summary: Add compare documents to command line interface
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: Commandline Document-Comparison
  Show dependency treegraph
Reported: 2015-09-03 14:04 UTC by Raniere Silva
Modified: 2023-01-10 10:25 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:
Regression By:

Screenshot of diff two documents at LibreOffice Writer (104.35 KB, image/jpeg)
2015-09-03 14:04 UTC, Raniere Silva

Note You need to log in before you can comment on or make changes to this bug.
Description Raniere Silva 2015-09-03 14:04:46 UTC
Created attachment 118394 [details]
Screenshot of diff two documents at LibreOffice Writer

## Motivation

I want to use Git (or any other version control tool) to handle versions of ODT (or DOC/DOCX) files. Git allows me to recovery any version that I saved and LibreOffice Writer has a compare document feature accessible from the "Edit" menu. If LibreOffice Writer offer access to the compare document feature from the command line will be possible to improve Git to show the diff between two versions of ODT from a Git repository.

## Suggestion

$ libreoffice --compare vX.X.X.odt vY.Y.Y.odt
Comment 1 Cor Nouws 2015-09-03 15:18:44 UTC
Thanks - nice idea!
Comment 2 james.smith572323 2016-02-15 13:55:11 UTC
I too wish to request this enhancement

It would be very useful to be able to compare documents (ODT, DOCX, etc) on the command line (eg in Headless mode), without loading the GUI. 

Essentially, a command line equivalent of EDIT --> COMPARE DOCUMENT.

## Suggestion

$ libreoffice --compare original.odt/docx final.odt/docx --output marked_up_version.odt/docx

Please feel free to get in touch if you have any alternate solutions.

Thanks, James
Comment 3 Reuben Thomas 2017-02-10 16:10:52 UTC
I'm interested in precisely this.

At present, it's straightforward to use odt2txt to view diffs in git, mercurial etc. as plain text; or alternatively one can check in the file in a flat XML format.

But this is really ugly! It would be so much better to be able to use the LibreOffice "Compare Document" interface.
Comment 4 Daniel Himmelstein 2017-10-03 20:07:52 UTC
+1 to command line access to comparing two documents using LibreOffice writer. This feature is available in the GUI (https://help.libreoffice.org/Common/Comparing_Versions_of_a_Document). However, for my application, we're interested in diffing documents automatically (https://github.com/greenelab/manubot-rootstock/issues/54).

This would be a hugely valuable feature. Perhaps a syntax such as:

libreoffice --writer --compare document_new.docx document_old.docx --output=document_diff.docx
Comment 5 Guillermo López Alejos 2017-10-14 13:29:19 UTC

I added the "enhancement" word at the beginning of the title (as suggested in [1]).

This enhancement is a requirement for people using version control systems to track changes to their documents.

Kind regards,


[1] https://ask.libreoffice.org/en/question/2533/request-a-feature/
Comment 6 Cor Nouws 2017-10-14 14:15:24 UTC Comment hidden (obsolete)
Comment 7 Guillermo López Alejos 2017-10-14 19:40:36 UTC Comment hidden (obsolete)
Comment 8 Cor Nouws 2017-10-14 19:45:14 UTC Comment hidden (obsolete)
Comment 9 Guillermo López Alejos 2017-10-14 19:55:08 UTC Comment hidden (obsolete)
Comment 10 Cor Nouws 2017-10-15 16:00:50 UTC
people interested in working on this feature: the code can be found in  
and other files in that directory.
I didn't look into that closely, but imagine that trying to find out how print or print_to work, may be helpful as example.
And of course devs are often willing to help with some advise.

Comment 11 Mandar Mitra 2023-01-10 10:25:40 UTC
Just a +1, along with a request to bring Calc documents into the scope of the enhancement.