3

This is a followup to svn or mercurial version control of word documents

I potentially want multiple non-programmers to be able to use version control on word documents. I can configure mercurial to look at the unzipped docx files. What I want is as follows:

  1. Read from Docx files (answered in that question, using a feature of mercurial to unzip before comparing, awesome!

  2. automatically merge documents whenever there are non-colliding changes. It appears from the previous answer that this is done using comparison tools.

  3. programmatically run word on the two documents if there are collisions, comparing the two.

I have manually opened one file, then another in Word to see what it was like. On my word 2004, it seems a bit buggy, but I see from reviews that the feature is much improved in 2010.

I found this link: http://office.microsoft.com/en-us/word-help/command-line-switches-for-microsoft-office-word-2007-HP010164010.aspx#BM1

for command lines, and now see that I can execute the command:

winword /q /f file1.docx /f file2.docx

The q is for quiet, /f specifies a file. The docs don't say if I can specify two files but I tried and it loads two in separate windows.

So the only thing I don't know is how to trigger word to compare the two.

Is the word interaction a fairly easy scripting job, or does it involve binary APIs that I don't want to know about, like DCOM, ActiveX, etc.

Community
  • 1
  • 1
Dov
  • 8,000
  • 8
  • 46
  • 75
  • 1
    Very interested in what you find for this, but I don't have an answer. Everything I've come across online basically says "Mercurial is good, but it's not good for everything, and dealing with binary format files that aren't easily mergable is one of those things". – DarinH Jun 21 '11 at 17:33
  • 1
    Concering your first question, didn't [this answer](http://stackoverflow.com/questions/6377043/followup-to-version-control-for-word-docs-any-way-to-merge-documents-with-mercur/6377154#6377154) solve your problem? Actually the second question is also handled in this answer by referencing the merge patterns. What I want to say: please use comments or question edits if the answers you've got don't solve your problem, please don't just ask the same question again. – Oben Sonne Jun 21 '11 at 17:51
  • @Oben, I guess you're right on the mercurial side. I had looked at the first reference you mentioned, the merge patterns, and forgot to look at the interactive tools. But running word is still unanswered I think. – Dov Jun 21 '11 at 18:11
  • 1
    I see, programatically opening Word for comparison indeed is new in this question :) – Oben Sonne Jun 21 '11 at 18:18
  • Looks like a dupe of this thread: http://stackoverflow.com/questions/6374469/svn-or-mercurial-version-control-of-word-documents the answers there might help you out. – DarinH Jun 21 '11 at 17:37

1 Answers1

0

Digging around in the TortoiseHg directory, I found some examples of scripts implementing diff/merge of doc files in the diff-scripts directory. There is an [extdiff] section in Mercurial.ini that can be configured to use this scripts. This may get you started.

Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251
  • I will take a look at this to see if it effectively replaces using word at all, thanks – Dov Jun 21 '11 at 18:31