GroupDocs.Comparison allows you to get result document object model after comparison.
To get result document object, follow these steps:
Instantiate the Comparer object. Specify the source document path or stream.
Call the Add method. Specify the target document path or stream.
Call the Compare method and assign its return value to a Document object.
You can retrieve the name, password, changes, stream and other document information using Document object. Also, our object model is fully compatible with the object models of Aspose libraries.
The following code snippets show how to get changes and create new Aspose Word document using result document object model:
Create a new Word document based on the result document and modify its contents
You can use the Comparison Document object to generate Aspose documents and perform modifications seamlessly. The resultDocument.Stream will contain an Aspose document object corresponding to the format being compared.
usingSystem;usingGroupDocs.Comparison;usingAspose.Words;// ...using(Comparercomparer=newComparer("source.docx")){// Add target document and save comparison result to Comparison.Document objectcomparer.Add("target.docx");GroupDocs.Comparison.DocumentresultDocument=comparer.Compare("result.docx");// Create a new Aspose Document object of corresponding format.Aspose.Words.DocumentasposeDocument=newAspose.Words.Document(resultDocument.Stream);// Access the Document's builder to add content.DocumentBuilderbuilder=newDocumentBuilder(asposeDocument);// Add some text to the document.builder.Writeln("Hello, World!");builder.Write("This is an example of using Aspose.Words.");// Save the document to a file.asposeDocument.Save("output.docx");}