Accept/reject the tracked changes on Excel workbook in C#/VB.NET

This article will show you how to accept/reject the tracked changes on Excel workbook in C#/VB.NET with the help of Spire.XLS.

C#
using Spire.Xls;

namespace TrackChanges_XLS
{
    class Program
    {
        static void Main(string[] args)

        {
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("Sample.xlsx");

            if (workbook.HasTrackedChanges)
            {
                workbook.AcceptAllTrackedChanges();
                //workbook.RejectAllTrackedChanges();
            }
                          
            workbook.SaveToFile("Result.xlsx", FileFormat.Version2013);
        }
    }
 }
VB.NET
Imports Spire.Xls

Namespace TrackChanges_XLS
    
    Class Program
        
        Private Shared Sub Main(ByVal args() As String)
            Dim workbook As Workbook = New Workbook
            workbook.LoadFromFile("Sample.xlsx")
            If workbook.HasTrackedChanges Then
                workbook.AcceptAllTrackedChanges
                'workbook.RejectAllTrackedChanges();
            End If
            
            workbook.SaveToFile("Result.xlsx", FileFormat.Version2013)
        End Sub
    End Class
End Namespace