Accept or Reject Tracked Changes in Word in Java

This article demonstrrates how to accept or reject all tracked changes in a Word document using Spire.XLS for Java.

Sample Document

Accept or Reject Tracked Changes in Word in Java

import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class AcceptOrRejectChanges {

    public static void main(String[] args) {

        //Create a Document object
        Document doc = new Document();
        
        //Load the sample Word file
        doc.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.docx");

        //Accept all changes in the entire document
        doc.acceptChanges();
        
        ////Reject all changes in the entire document
        //doc.rejectChanges();
        
        //Save the document
        doc.saveToFile("AcceptAllChanges.docx", FileFormat.Docx);
    }
}

Output

Accept or Reject Tracked Changes in Word in Java