How to convert DOCX with revisions to PDF format
using C# and VB.NET


Turning on Track Changes gives you and your coworkers a way to make changes that are easy to spot. The changes are like suggestions that you can review, and then remove them or make them permanent.

This code example shows how you can accept or reject revisions.

Download the example file: example.docx

Download the resulting file: result.pdf

Complete code

using SautinSoft.Document;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            Revision();
        }
        /// <summary>
        /// Shows how to work with revisions.
        /// </summary>
        /// <remarks>
        /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/revision-track-changes-net-csharp-vb.php
        /// </remarks>
        static void Revision()
        {
            DocumentCore dc = DocumentCore.Load(@"..\..\example.docx");
           
            // Accepting the deletion revision will assimilate it into the paragraph's inlines and remove them from the collection.
            dc.Revisions[0].Accept();

            // The second insertion revision is now at index 0, which we can reject to ignore and discard it.
            dc.Revisions[0].Reject();

            // Now we have two revisions in the list items, we accept them all.
            dc.Revisions.AcceptAll();

            dc.Save(@"result.pdf");
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(@"result.pdf") { UseShellExecute = true });
        }
    }
}

Download.

        
            Imports SautinSoft.Document

Namespace Example
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			Revision()
		End Sub
		''' <summary>
		''' Shows how to work with revisions.
		''' </summary>
		''' <remarks>
		''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/revision-track-changes-net-csharp-vb.php
		''' </remarks>
		Private Shared Sub Revision()
			Dim dc As DocumentCore = DocumentCore.Load("..\example.docx")

			' Accepting the deletion revision will assimilate it into the paragraph's inlines and remove them from the collection.
			dc.Revisions(0).Accept()

			' The second insertion revision is now at index 0, which we can reject to ignore and discard it.
			dc.Revisions(0).Reject()

			' Now we have two revisions in the list items, we accept them all.
			dc.Revisions.AcceptAll()

			dc.Save("result.pdf")
			System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo("result.pdf") With {.UseShellExecute = True})
		End Sub
	End Class
End Namespace

          

Download.


If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below:



Questions and suggestions from you are always welcome!

We are developing .Net components since 2002. We know PDF, DOCX, RTF, HTML, XLSX and Images formats. If you need any assistance with creating, modifying or converting documents in various formats, we can help you. We will write any code example for you absolutely free.