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)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Commandline
  Show dependency treegraph
 
Reported: 2015-09-03 14:04 UTC by Raniere Silva
Modified: 2017-10-15 16:00 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


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

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
james.smith572323@gmail.com
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
Hi,

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,

Guillermo

[1] https://ask.libreoffice.org/en/question/2533/request-a-feature/
Comment 6 Cor Nouws 2017-10-14 14:15:24 UTC
(In reply to Guillermo López Alejos from comment #5)

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

No need for that Guillermo. The field 'Severity' (in a bug already filed, after the field 'Importance'), already has this :)

But thanks for your extra explanation!
Cor
Comment 7 Guillermo López Alejos 2017-10-14 19:40:36 UTC
(In reply to Cor Nouws from comment #6)

> No need for that Guillermo. The field 'Severity' (in a bug already filed,
> after the field 'Importance'), already has this :)

Thank you Cor, I didn't notice that field.
Comment 8 Cor Nouws 2017-10-14 19:45:14 UTC
(In reply to Guillermo López Alejos from comment #7)

> Thank you Cor, I didn't notice that field.

No problem. Maybe the lay out (of an existing report as this) can be improved at that point?
Ciao!
Comment 9 Guillermo López Alejos 2017-10-14 19:55:08 UTC
(In reply to Cor Nouws from comment #8)

> No problem. Maybe the lay out (of an existing report as this) can be
> improved at that point?

Errr... are we in a position to fix that? Maybe we should discuss this matter in a different place to avoid drifting the focus from the main topic of enhancement request #93891: run the compare documents process from the command line.

Best,

Guillermo
Comment 10 Cor Nouws 2017-10-15 16:00:50 UTC
people interested in working on this feature: the code can be found in  
  desktop/source/app/cmdlineargs.cxx 
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.

Ciao,
Cor