在Windows 7的Sourcetree中Diff Word docx文件 [英] Diff Word docx files in Sourcetree on Windows 7

查看:432
本文介绍了在Windows 7的Sourcetree中Diff Word docx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Windows 7上的Sourcetree中使用Word .docx文件的文本比较。我已经按照这里的说明使用Microsoft Word和git来使用Pandoc,并且可以通过命令行使其工作。不幸的是,我无法让这个差异出现在Sourcetree中。有什么我需要做的,以使这个工作?



这是我放在我的项目的根目录我的.gitattributes文件:

 #添加docx文件的差异。 
* .docx diff = word

这是我的.git \config文件:

  [core] 
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[diffword]
textconv = pandoc --to =降价
prompt = false
[别名]
wdiff = diff --word-diff = color --unified = 1


解决方案

我正在寻找同样的问题。 Pandoc似乎不适合SourceTree,我想知道一个合适的选择。然后我回忆起WinMerge几年前用外部工具 xdocdiff 解决了这个问题。步骤:



这行允许我在SourceTree中查看diff预览。


I have been trying to get a text diff of Word .docx files working in Sourcetree on Windows 7. I have followed the instructions here Using Microsoft Word with git to use Pandoc and can get it working from the command line. Unfortunately I can't get that diff to appear in Sourcetree. Is there something else I need to do to get this to work?

Here's my .gitattributes file that I've put in the root of my project:

# Add diff of docx files.
*.docx diff=word

Here's my .git\config file:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[diff "word"]
  textconv=pandoc --to=markdown
  prompt = false
[alias]
  wdiff = diff --word-diff=color --unified=1

解决方案

I was looking for the same problem. Pandoc seems not working well with SourceTree, and I was wondering for a valid alternative. Then I remebered that WinMerge solved years ago with an external tool, xdocdiff. The steps:

  • (If you alredy haven't) download xdocdiff here, you can install as suggested or put in a folder you like;
  • Add the folder in the Windows PATH variable, as described here (a reboot is required to takes effect);
  • Verify that everything works by typing in a Command Line window the command xdoc2txt, the output will be the usage helper (like below):

    > xdoc2txt
    Usage: xdoc2txt [-s|-e|-j][-c][-f][-r=(0|1|2)] <filename...>
            -s : convert to ShiftJIS(default)
            -e : convert to EUC
            -j : convert to JIS
            -f : output to file
            -c : activate PDF cache
            -p : print property
            -n : ignore permission on PDF;(require cryptlib.dll)
            -r=(0|1|2) : ruby style(0:suppress 1:parentheses 2:aozora bunko
            -o=0 : other option; -o=0:no show PDF page#
            -g=# : PDF gap parameter
            -v : show version number
            -x : output existing cell only(for EXCEL2007)
    

    go on only if this command works;

  • Add or edit the .gitattributes file in the root of the project:

    *.doc diff=xdoc2txt
    *.xls diff=xdoc2txt
    # ...
    # add any other supported extensions you need
    

  • Edit the .git\config file in the root of the project:

    [diff "xdoc2txt"]
      textconv = xdoc2txt
      cachetextconv = true
      binary = true
      prompt = false
    

This lines allows me to see the diff preview inside SourceTree.

这篇关于在Windows 7的Sourcetree中Diff Word docx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆