如何判断两个Word文档是否相同使用文字互操作 [英] How to determine whether two word documents are the same using word interop

查看:341
本文介绍了如何判断两个Word文档是否相同使用文字互操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有看到如果两个文件都用这个词互操作同样的好办法

Is there a good way to see if two documents are the same using the word interop?

我一直在使用类似的尝试:

I have tried using something like:

Word.Document tempDoc = app.CompareDocuments(document1, document2);



我的问题是,tempDoc不为空,如果他们是一样的,所以我不知道如何使用该结果来确定文档是否是相同的。

My issue is that tempDoc is not null if they are the same, so I'm not sure how to use this result to determine whether the documents are the same.

预先感谢!

推荐答案

它返回的文档与修订文档打开。因此,所有你需要做的就是看看是否有任何变化。所以:

The document it returns is a document with track changes turned on. So all you have to do is see if there ARE any changes. So:

Document tempDoc = app.CompareDocuments(doc1, doc2);
bool anyChanges = tempDoc.Revisions.Count > 0;

请参阅:

http://msdn.microsoft.com/en-us/library/microsoft。 office.interop.word._application.comparedocuments.aspx

这篇关于如何判断两个Word文档是否相同使用文字互操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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