We are planning to use the GroupDocs.Comparison product for comparing MS Word and MS Excel. In MS Word when we use this GroupDocs.Comparison product we could be able to use the “Track changes” feature of MS word and Accept and Reject the changes.
We want do the same in MS Excel also. But in MS Excel the “Track changes” feature is not working similar to what we see in MS Word. We cannot accept the “Track changes” feature using the Accept and Reject button in MS Excel.
Could you able check this and provide some information.
Source and target Excel files included below. Files.zip (49.6 KB)
GroupDocs.Comparison API version ->v22.8.0
Sample code:
using GroupDocs.Comparison;
string licensePath = “C://Reports//GroupDocs.Total.Product.Family.lic”;
License license = new License();
//var ass = license.GetType().Assembly;
license.SetLicense(licensePath);
using (Comparer comparer = new Comparer(@"C:/Reports/Disclosure_Source.xlsx"))
{
comparer.Add(@"C:/Reports/Disclosure_Target.xlsx");
comparer.Compare(@"C:/Reports/Excel_Result.xlsx");
var changes = comparer.GetChanges();
}
Text or the changes that you want to reject:
a) Once the compare operation is done and in the “Excel_Result.xlsx” how the user can use the “Track Changes” option to Accept or Reject the changes?
You can see the red and green markings of the changes, But how would the end user would be able to use the “Track Changes” option to Accept or Reject the changes? image.png (63.5 KB)
b) The “Final” tab from Source file is not in the “Excel_Result.xlsx” file. But the content of the “Final” tab is in “Review” tab with red rectangle. image.png (57.2 KB)
c) We want the comparison to work like this.
We want the contents on the Target file to stay. Any difference from Source need to be added to the Target file as the differences. This difference we want the user to be able to accept or reject using the “Track Changes” option to Accept or Reject the changes.
Comparison to work on the tabs also. In the example provided we want the “Final” tab included in the “Excel_Result.xlsx” file and shown as a difference.
d) What is the information in the “Summary page” on the “Excel_Result.xlsx” file? How can we use it?
Let us explain who accept or reject changes work in case of GroupDocs.Comparison. Please take a look at the code below:
using (Comparer comparer = new Comparer("source.xlsx"))
{
comparer.Add("target.xlsx");
comparer.Compare();
ChangeInfo[] changes = comparer.GetChanges();
changes[0].ComparisonAction = ComparisonAction.Reject;
comparer.ApplyChanges(File.Create("result.docx"), new SaveOptions(), new ApplyChangeOptions() { Changes = changes });
}
You have to pass source and target files to the API. It’ll compare them and you get the changes in ChangeInfo[]. Once you have the array of changes, you can accept or reject them: changes[0].ComparisonAction = ComparisonAction.Reject;
Among the changes you have in the array, changes[0] will be rejected and won’t affect in the output file.
However, the accept and reject feature provided be the native applications (e.g. MS Word or Excel), they are something different. GroupDocs API is not linked with them.
Yes, you can ChangeInfo[] shows you if the content is deleted or inserted. However, we are furhter investigating if we can detect the style changes (e.g. font color, or style).
We are also investigating this scenario.
Your investigation ticket ID is COMPARISONNET-3215.
While we compare the word document (Source.docx and Target.docx) wanted to check below scenario possible.
First time any changes in the Target.docx the user reviews and rejects it. When the same “Target.docx” file is compared second time would it be possible to ignore the previously rejected changes to appear from the “Track changes”?.
Can we make the second time or third time compare the “Track changes” would ignore the previously rejected “Track changes” from the “Target.docx” file.
Now what is happening is every time the compare is run the “Track changes” shows the same difference which is already rejected by the user when they review the “track changes”. This makes the user to repeatedly “reject” the “Track changes” from “Target.docx” file.
Does this reply you have given “Show results of comparison as a Excel Track Changes is not supported by API.” is documented in your documentation for MS Excel? Could you able to share that link?
For Word documents, yes, it is doable (in common as it was described). Could you please send a document samples and especially expected results (so we could more precisely test this and understand what exactly is required).
Attaching the 1.Source.docx 2.Target.docx and 3.Result_Expected.docx files.
In the “Result_Expected.docx” file expecting the below
The 3rd line “More text from Source.” from “Source.docx” is inserted. This will appear in the “Track changes” as Insertion which is expected.
The last line " This is entity specific changes" is not included in the “Track Changes” as it is already in the “Target.docx” file and want to ignore that as a “Track Changes”
You can check the “Result_Expected.docx” which is the compare expected result. It should not show the last line " This is entity specific changes" as deleted “Track Changes” as this line is specific to the “Target.docx” file which we want to ignore.
Please take a look at following outcome:
If you want to see the “Track Changes” as MS Word does with the ability to “Reject” “Accept“ changes, you should provide the WordTrackChanges boolean flag to CompareOptions so the “Track Changes” feature would appear instead of common GroupDocs.Compoparison comparing. See this documentation article.
So, after comparing process with the files that you shared earlier, you would receive the attached result file - Result.zip (9.7 KB).
There you can see that “More text from Source.” is tracked as DELETED because there is no such an paragraph in Target file and “This is entity specific changes” as INSERTED because it was added to the target file.
So, it is starting to be unclear from the point below:
Could you please elaborate, what you want to achieve, the " This is entity specific changes" paragraph is always gonna be marked as INSERTED because that is how API works. Can you please provide the full ‘step by step’ description or a demonstration video what you want to achieve and what you do with files before/after comparing?
We can manipulate the “Track Changes Revisions“ before/after comparing but we don’t understand what manipulation you want to be done exactly?