0

我刚刚在命令行解决方案中得到了比较词。并尝试通过 TortoiseSVN 差异脚本(diff-doc.js) 比较两个单词文件,但我发现它显示了关于字体或段落设置的许多差异。

是否有任何关于如何修改 diff-doc.js 以忽略字体更改和忽略段落格式更改的代码示例?我只想在第一时间专注于文本内容。

4

1 回答 1

0

我不是 100% 确定你在问什么,但你可以在 vbscript 中做这样的事情:

strPath1 = [the location of the first file]
strPath2 = [the location of the second file]
strLog = [the location of a log file]

set ofs =  CreateObject("Scripting.FileSystemObject")


'create a log file
If Not oFs.FileExists(strLog) Then
    set logFile = oFs.CreateTextFile(strLog, true)
else
set logFile = oFs.openTextFile (strLog, 8, True)
End if

set file1 = ofs.openTextFile (strPath1)
strFile1Buffer = file1.readAll
file1.close

set file2 = ofs.openTextFile (strPath2)

do while not file2.atEndOfStream
    strLine = file2.readLine
    If InStr(strFile1Buffer, strLine) = 0 Then
        strLogEntry = strLogEntry & strLine & vbCrLf
    End If
Loop

file2.Close

strLogEntry = "Lines that are in file1 but not in file2:" & vbCrLf & strLogEntry

logFile.WriteLine strLogEntry
objFile3.Close

看看这个:http: //blogs.technet.com/b/heyscriptingguy/archive/2007/05/24/how-can-i-compare-the-contents-of-two-text-files.aspx

于 2012-11-01T16:26:33.147 回答