[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Hyphenation
    Spell Checking
    AutoCorrect Feature
    Track Changes
    Mail Merge
    Restrictions and Protection
   [Expand]Visual Elements
    Services
    Events
    Commands
    Keyboard Shortcuts
    HTML Tag Support
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Track Changes

The RichEditControl allows you to track changes in a document. You can view, accept or reject revisions made to a document.

The RichEditControl supports Track Changes in the following formats:

  • DOCX;
  • DOC;
  • RTF;
  • WordML;
  • HTML;
  • PDF (export only).

Expanded Enable Track Changes in the Document

In Code

Use the following API to enable Track Changes and specify the revision options:

API Description
Document.TrackChanges Provides access to the document's tracking options (DocumentTrackChangesOptions (see DocumentTrackChangesOptions)).
DocumentTrackChangesOptions.Enabled Enables tracking in the document. When tracking is enabled, new document modifications are added as revisions.
DocumentTrackChangesOptions.TrackFormatting<br/>DocumentTrackChangesOptions.TrackMoves Specifies whether to track formatting changes (character, paragraph, section and table properties' changes) or content movements.

The code sample below shows how to enable Track Changes and change formatting options for the specified range. As a result, a new revision is added to the collection:

Note

A complete code sample project is available at the How to Manage Tracked Changes repository on GitHub.

From the User Interface

The Review ribbon tab allows users to keep track of changes made in the current document.

The Track Changes drop-down menu allows you to enable track changes and provide a password to prevent users from disabling Track Changes.

Expanded Show Revisions from Specific Authors

In Code

The AnnotationOptions (see AnnotationOptions) class properties allow you to specify the current author and authors whose revisions should be displayed.

From the User Interface

Use the Show Markup drop-down menu to select reviewers whose revisions should be displayed.

Expanded Change Display Options for Revisions

In Code

The TrackChangesOptions (see TrackChangesOptions) class properties allow you to specify revision display options for the RichEditControl. You can specify a color and format for each revision type and change the review mode.

Access these properties via the richEditControl.Options.Annotations.TrackChanges notation.

Tip

Set the TrackChangesOptions.DisplayForReviewMode property to DisplayForReviewMode.NoMarkup to hide changes when the document is printed or exported to PDF.

From the User Interface

Use the Display for Review drop-down list to specify how to display changes in the document.

The RichEditControl provides the following modes:

  • All Markup - displays revisions in details.

  • Simple Markup - displays revisions indicated by a red line in the margin.

  • No Markup - displays the document without any visible revisions (as if all revisions are accepted).

Expanded Access Revisions

The Document.Revisions property provides access to the read-only collection of document revisions.

Call the RevisionCollection.Get method to retrieve revisions related to a document part (main body, header, footer, and text box). Pass the target SubDocument (see SubDocument) instance as the method's parameter. The following properties allow you to access a specific document part's SubDocument:

Document Part Property
Main Body RichEditControl.Document
Header or Footer Section.BeginUpdateHeader<br/> Section.BeginUpdateFooter
Text Box TextBox.Document

The RevisionCollection.Get method overload allows you to retrieve changes made to a document range.

The code sample below shows how to retrieve revisions made in the first section's header and in the first paragraph:

Expanded Accept and Reject Revisions

In Code

Use the Revision (see Revision) object's properties to obtain the revision's date, author, and type. The Revision.Range property provides access to the document range to which the revision is applied. This property retrieves the range after the revision.

Call the Revision.Accept or Revision.Reject method to accept or reject a specific revision.

Use the RevisionCollection.AcceptAll or RevisionCollection.RejectAll method to manage all revisions in the document or in specific document part.

The code sample below shows how to reject all revisions on the first page's header:

Pass the System.Predicate`1 delegate as one of the method's parameter to accept or reject all revisions that meet the given criteria.

The code sample below rejects all revisions in the first section from the specific author:

From the User Interface

You can use the buttons on the Changes ribbon group or context menu items to move between revisions, accept or reject changes.

Expanded Revision Conflicts

When you move text, change it, and then reject this move, a conflict occurs that fires Document.TrackedMovesConflict and RichEditControl.TrackedMovesConflict events. Handle one of the events to specify the version of the text you want to keep (the ResolveMode (see TrackedMovesConflictEventArgs.ResolveMode) property).

Use the OriginalLocationRange (see TrackedMovesConflictEventArgs.OriginalLocationRange) and TrackedMovesConflictEventArgs.NewLocationRange properties to obtain the original and new location range, and the TrackedMovesConflictEventArgs.Revision property to retrieve the revision that fired this event.

The code sample below shows how to handle the TrackedMovesConflict event:

Expanded Limitations

Track Changes has the following limitations:

  • Revisions in OpenDocument (.odt) format are not supported.
  • No Original mode to view changes.
  • No user interface elements to specify Track Changes display options.
  • The Reviewing Pane does not display revisions.
  • Revisions are not displayed in balloons that appear in document margin.

Is this topic helpful?​​​​​​​