possibility to manually accept or decliend track change changes

Hi, 

I am using document editor (Version: 19.2.44) in my Angular Application. 

I would like to know if it is possible to manually accept/decline changes tracked by track changes functionality. 

Manually I mean: accept changes by from ts file.

Also If possible, How can I accept or decliend all changes manually from .ts file.


Regards,




8 Replies

SM Suriya Murugan Syncfusion Team August 4, 2021 07:42 AM UTC

Hi Parthkumar, 

Syncfusion Greetings! 

Using AcceptAll and RejectAll API, you can accept and reject changes programmatically. 

Code snippet: 
documentEditor.revisions.acceptAll() 
documentEditor.revisions.rejectAll() 



Please let us know if you have any questions. 

Regards, 
Suriya M. 



PK Parthkumar Kakadiya replied to Suriya Murugan August 11, 2021 02:07 PM UTC

Hi Suriya,

Your suggestion helped me. Working fine.


I need small requirement with Accept, decliend, AcceptAll and declinedAll method. I would like to listen these event. I want to execute some funcion whenever user perform any of these action.


Regards,

Parth



SM Suriya Murugan Syncfusion Team August 12, 2021 11:13 AM UTC

Hi Parth, 

We are sorry to say that we don’t have requested event. Can you please the detailed description about your requirement with use case scenario, what you are going to do once event triggered? Please share the requested details to proceed further and provide you solution at earliest.  

Regards, 
Suriya M. 



PK Parthkumar Kakadiya August 12, 2021 03:01 PM UTC

Hi Suriya,


So I tried to explain my case: 


  1. whenever user click on the AcceptAll, User could able to make further changes without track changes and also able to save docx into database
  2. whenever user click on the DeclinedAll, User should not able to make any further changes in editor and just save docx in database
  3. if single changes is declined than I wanted to store docx in different table 

As it's user click, I should some how listen to these events. It plays vital role for management of the document. 


So What I wanted to achieve is to listen all four user driven event so that we can provide proper management of documnet to the user.

Reagrds,
  


KB Kurthis Banu Abdul Majeeth Syncfusion Team August 13, 2021 12:48 PM UTC

Hi Parth,  

Currently We have an internal API, but it’s not exposed yet. We will check and update the further details on August 16,2021. 

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team August 17, 2021 12:49 PM UTC

Hi Parth,  

We are cross checked your requirement. You can achieve this in server-side using DocIO.It is used to keep track of the changes made to a Word document. It helps to maintain the record of author, name and time for every insertion, deletion, or modification in a document. This can be enabled by using the TrackChanges property of the Word document. 

For your reference, we have prepared the sample in below link: 
 (Please find the code changes in DocumentEditorController.cs file in SaveDocument method) 
 
In this sample illustrates how to accept all the changes made by an author in Word document using the DocIo Syncfusion Word Library. 

Documentation Link: 

Please let us know if you have any questions. 

Regards, 
Kurthis Banu A. 



PK Parthkumar Kakadiya August 18, 2021 11:24 AM UTC

Hi Kurthis,


Thank you for providing inputs for the requirement. 


to be honest, I didn't unserstand the how it's goona work.


I did added SaveDocument Method into my DocumentEditorCntroller.cs file. As I using docker contianer for .Net Core API, I compiled and it compiled sucessfully with your code. 


Than I added trackchanges property into DocumentEdiotr like this: 

<ejs-documenteditorcontainer #documentEditorDefault [enableLocalPaste]=false [enableToolbar]=true
id="documentEditorDefault" [locale]="locale" name="documentEditor"
(keydown)="onClipboardPast($event)" [toolbarItems]="toolbarItems" (trackChange)="trackChangesEvent($event)"
(contentChange)="onContentChange($event)" [enableTrackChanges]=trackChangesBool
(created)="onCreate()" (documentChange)="onDocumentChange()" [currentUser]="currentUser"
(drop)="onDragEditor($event)" (selectionChange)="onSelectionChange()">
</ejs-documenteditorcontainer>

Now whenever I accept or reject nothing is happening in case of listing accept/declined event. 


Can you please provide me the example of your suggestion and what expected result it gives me after implementing this code?


Also is it possible to make this issue as an instance to solve it fast pace. 


Regards,

Parth



KB Kurthis Banu Abdul Majeeth Syncfusion Team August 19, 2021 05:04 AM UTC

Hi Parth,
Kindly ignore the last update.
You can achieve your requirement using DocIO in server-side. In Document editor you can accept and reject the changes UI level only .We don’t have a public API for your requirement. We are suggestion to use DocIO functionalities to achieve your requitement.
Documentation Link:
A complete, working example can be downloaded from below link
Syncfusion greatly facilitates the developer community with the feature-rich Word processing components that allows to add advanced Word document reviewing capabilities within your applications.
· An advanced Word Processor (editor) to track changes in a Word document using its intuitive user interface in Web applications.
· A comprehensive Word library that allows to access and accept or reject the tracked changes in a Word document using its powerful APIs in .NET and Java.

Intuitive user interface to track changes in Syncfusion Word Processor

When the track changes option is enabled in the Word Processor component, the edits or changes made are marked as
· Strikethrough for deleted information, and
· Underline for inserted information.
This component provides intuitive user interface to do the following actions with the track changes.
· Enable or disable track changes ability of the editor
· Access all the tracked revisions.
· Accept or reject a specific change
· Accept or reject all the changes
· Filtering changes based on the particular user
· Navigate between the changes
Note: Word Processor (Document Editor) component requires server-side interaction for the below-listed operations.
  • Import (open) Word Document
  • Paste with formatting
  • Restrict Editing
  • Spell Check
You can get the Web API project from this GitHub location.

Accept or reject changes using Syncfusion DocIO Word library

Syncfusion provides comprehensive Word library in both .NET (C#, VB.NET) and Java, hence you have complete freedom in opting the best fit server-side automation code for your project. It provides powerful APIs to access revisions (tracked changes) and accept or reject a change or group of changes.
You can automate accepting or rejecting the tracked changes in server-side using Syncfusion Word library before displaying the Word document in web browser (using Syncfusion Word Processor). Before accepting or rejecting the changes, you can validate and filter the changes based on the following,
1. Authors
2. Revision types (Insertion, Deletion, Formatting, MoveFrom, MoveTo, StyleDefinitionChange)
This example accepts/rejects the tracked changes from the following Word document.
Illustration of input Word document to accept or reject the tracked changes

Accept the changes
The following C# code example illustrates how to accept all the changes made by an author in Word document using the Syncfusion Word Library.
//Reads the input Word document
//Kindly give your path with input document.
Stream inputStream = File.OpenRead(Path.GetFullPath(@"../../../../../../Data/InputWithTrackedChanges.docx"));
string authorName = "Steven Buchanan";
int acceptedChangesCount = AcceptChanges(inputStream, authorName);
Console.WriteLine("Accepted {0} changes made by {1}.", acceptedChangesCount, authorName);
static int AcceptChanges(Stream inputStream, string authorName)
{
int acceptedChangesCount = 0;
//Creates new Word document instance for Word processing
using (WordDocument document = new WordDocument())
{
//Opens the Word document containing tracked changes
document.Open(inputStream, FormatType.Docx);
inputStream.Dispose();
//Iterates all the revisions present in the Word document
for (int i = document.Revisions.Count - 1; i >= 0; i--)
{
//Validates the author of current revision to accepts/rejects it
if (document.Revisions[i].Author == authorName)
{
//Accepts the current revision
document.Revisions[i].Accept();
acceptedChangesCount++;
}
//Resets i to last item, since accepting one revision will impact all its related revisions and leads to change in Revsions
if (i > document.Revisions.Count - 1)
i = document.Revisions.Count;
}
//Saves the Word document as DOCX format
using (Stream docStream = File.Create(Path.GetFullPath(@"../../../OutputAfterAcceptingChanges.docx")))
{
document.Save(docStream, FormatType.Docx);
}
}
return acceptedChangesCount;
}
The resultant Word document looks as follows.
GitHub link:
Illustration of output Word document after accepting changes
Similarly, you can filter all the changes made by an author and reject the filtered changes in Word document.

Reject the changes

The following C# code example illustrates how to reject the insert and delete revisions made by all authors and keep the formatting changes in Word document using the Syncfusion Word Library.
//Reads the input Word document
Stream inputStream = File.OpenRead(Path.GetFullPath(@"../../../../../../Data/InputWithTrackedChanges.docx"));
RevisionType revisionType = RevisionType.Insertions | RevisionType.Deletions;
int rejectedChangesCount = RejectChanges(inputStream, revisionType);
static int RejectChanges(Stream inputStream, RevisionType revisionType)
{
int rejectedChangesCount = 0;
//Creates new Word document instance for Word processing
using (WordDocument document = new WordDocument())
{
//Opens the Word document containing tracked changes
document.Open(inputStream, FormatType.Docx);
inputStream.Dispose();
//Iterates all the revisions present in the Word document
for (int i = document.Revisions.Count - 1; i >= 0; i--)
{
//Validates the revision type of current revision to accepts/rejects it
if ((document.Revisions[i].RevisionType & revisionType) != 0)
{
//Rejects the current revision
document.Revisions[i].Reject();
rejectedChangesCount++;
}
//Resets i to last item, since rejecting one revision will impact all its related revisions and lead to change in Revsions
if (i > document.Revisions.Count - 1)
i = document.Revisions.Count;
}
//Saves the Word document as DOCX format
using (Stream docStream = File.Create(Path.GetFullPath(@"../../../OutputAfterRejectingChanges.docx")))
{
document.Save(docStream, FormatType.Docx);
}
}
return rejectedChangesCount;
}
The resultant Word document looks as follows.
GitHub Link:
Regards,
Kurthis Banu A.



Loader.
Up arrow icon