在Windows 7的Sourcetree中Diff Word docx文件 [英] Diff Word docx files in Sourcetree on Windows 7
问题描述
我一直试图在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 解决了这个问题。步骤: 验证一切正常在命令行窗口输入命令 go如果此命令有效; 添加或编辑 编辑
PATH
变量,如
xdoc2txt
,输出将是使用助手(如下所示):
> xdoc2txt
用法:xdoc2txt [-s | -e | -j] [ - c] [ - f] [ - r =(0 | 1 | 2)]< filename ...>
-s:转换为ShiftJIS(默认)
-e:转换为EUC
-j:转换为JIS
-f:输出到文件
-c:激活PDF缓存
-p:打印属性
-n:忽略PDF上的权限;(需要cryptlib.dll)
-r =(0 | 1 | 2):ruby style(0:压缩1:括号2:aozora bunko
-o = 0:其他选项; -o = 0:不显示PDF页面#
-g =#:PDF差距参数
-v:显示版本号
-x:仅输出现有单元格(对于EXCEL2007)
.gitattributes
文件项目的根源:
*。doc diff = xdoc2txt
* .xls diff = xdoc2txt
#...
#添加您需要的任何其他支持的扩展程序
.git \config
文件位于项目的根目录中:
[diffxdoc2txt]
textconv = xdoc2txt
cachetextconv = true
binary = true
prompt = false
这行允许我在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屋!