# Accept or Reject detected changes Accept or reject individual changes found by Comparer.GetChanges() and write the result using ApplyChanges() — with optional SaveOriginalState to keep both outcomes in GroupDocs.Comparison for .NET. [GroupDocs.Comparison](https://products.groupdocs.com/comparison/net) allows you to apply or discard specific changes between source and target documents and save output document with (or without) selected changes. To apply/reject changes to output document, follow these steps: 1. Instantiate the [Comparer](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer) object. Specify the source document path or stream. 2. Call the [Add](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/methods/add/index) method. Specify the target document path or stream. 3. Call the [Compare](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/methods/compare/index) method. 4. Call the [GetChanges](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/methods/getchanges/index) method to get changes list. 5. Set the [ComparisonAction](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.result/changeinfo/properties/comparisonaction) of the appropriate change object to the [ComparisonAction.Accept](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.result/comparisonaction) or [ComparisonAction.Reject](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.result/comparisonaction) value. 6. Call the [ApplyChanges](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/methods/applychanges/index) method. Specify the collection of changes. [ApplyChangeOptions](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/applychangeoptions) class includes the following properties: - [Changes](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/applychangeoptions/properties/changes) is a list of changes that must be applied (or not) to the output document - [SaveOriginalState](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/applychangeoptions/properties/saveoriginalstate) is an option to keep the original state of the compared result after applying changes The following code snippets show how to accept/reject changes: ## Accept or Reject changes for documents stored at local disk {{< tabs "example1">}} {{< tab "C#" >}} ```csharp using GroupDocs.Comparison; using GroupDocs.Comparison.Options; using GroupDocs.Comparison.Result; using System.IO; // ... using (Comparer comparer = new Comparer("source.docx")) { comparer.Add("target.docx"); comparer.Compare(); ChangeInfo[] changes = comparer.GetChanges(); changes[0].ComparisonAction = ComparisonAction.Reject; comparer.ApplyChanges(File.Create("result.docx"), new SaveOptions(), new ApplyChangeOptions() { Changes = changes }); } ``` {{< /tab >}} {{< /tabs >}} The result is as follows: | Accepted changes | Rejected changes | | :-----------------------------------------------------------------: | :----------------------------------------------------------------: | | ![](https://docs.groupdocs.com/comparison/net/images/accepted-changes.png) | ![](https://docs.groupdocs.com/comparison/net/images/rejected-changes.png) | ## Accept or reject changes for documents provided as a stream {{< tabs "example2">}} {{< tab "C#" >}} ```csharp using GroupDocs.Comparison; using GroupDocs.Comparison.Options; using GroupDocs.Comparison.Result; using System.IO; // ... using (Comparer comparer = new Comparer(File.OpenRead("source.docx"))) { comparer.Add(File.OpenRead("target.docx")); comparer.Compare(new SaveOptions(), new CompareOptions()); ChangeInfo[] changes = comparer.GetChanges(new GetChangeOptions()); changes[0].ComparisonAction = ComparisonAction.Reject; comparer.ApplyChanges(File.Create("result.docx"), new SaveOptions(), new ApplyChangeOptions() { Changes = changes }); } ``` {{< /tab >}} {{< /tabs >}} ## Accept or reject detected changes using SaveOriginalState option {{< tabs "example3">}} {{< tab "C#" >}} ```csharp using GroupDocs.Comparison; using GroupDocs.Comparison.Options; using GroupDocs.Comparison.Result; using System.IO; // ... using (Comparer comparer = new Comparer("source.docx")) { comparer.Add("target.docx"); comparer.Compare(); ChangeInfo[] changes = comparer.GetChanges(); changes[0].ComparisonAction = ComparisonAction.Reject; comparer.ApplyChanges("resultWithRejectedChange.docx", new ApplyChangeOptions() { Changes = changes, SaveOriginalState = true }); changes = comparer.GetChanges(); changes[0].ComparisonAction = ComparisonAction.Accept; comparer.ApplyChanges("resultWithAcceptedChange.docx", new ApplyChangeOptions() { Changes = changes }); } ``` {{< /tab >}} {{< /tabs >}} ## See also - [Accept or reject revisions]({{< ref "comparison/net/advanced-usage/accept-or-reject-revisions.md" >}}) — for native Word track-changes processing without comparison - [Get list of changes]({{< ref "comparison/net/advanced-usage/comparison/get-list-of-changes.md" >}}) - [Compare documents]({{< ref "comparison/net/comparison-basic/compare-documents.md" >}})