文档彩票走势图>>E-iceblue中文文档>>比较两个 Word 文档
比较两个 Word 文档
Spire.Doc for .NET 支持比较两个 Word 文档并找出它们之间的差异。在本文中,您将学习如何使用 Spire.Doc for .NET 来比较 C# 和 VB.NET 中的两个 Word 文档。
输入的 Word 文档:
【C#】
using Spire.Doc; namespace CompareWordDocuments { class Program { static void Main(string[] args) { //Create a Document instance Document doc1 = new Document(); //Load the first Word document doc1.LoadFromFile("Doc1.docx"); //Create a Document instance Document doc2 = new Document(); //Load the second Word document doc2.LoadFromFile("Doc2.docx"); //Compare the two Word documents doc1.Compare(doc2, "Shawn"); //Save the result to file doc1.SaveToFile("Result.docx"); doc1.Dispose(); } } }
【VB.NET】
Imports Spire.Doc Namespace CompareWordDocuments Class Program Private Shared Sub Main(ByVal args As String()) ‘Create a Document instance Dim doc1 As Document = New Document() ‘Load the first Word document doc1.LoadFromFile("Doc1.docx") ‘Create a Document instance Dim doc2 As Document = New Document() ‘Load the second Word document doc2.LoadFromFile("Doc2.docx") ‘Compare the two Word documents doc1.Compare(doc2, "Shawn") ‘Save the result to file doc1.SaveToFile("Result.docx") doc1.Dispose() End Sub End Class End Namespace
输出:
欢迎下载|体验更多E-iceblue产品