Free Support Forum -

Render word document with change tracking as XPS


We are developing a document viewer which shows XPS documents and have found that our customers rely heavily on the Track Changes feature in Word. When a docx file is saved as an XPS document, all the formatting associated with the change tracking is removed, though the change text is not. For example, if I remove a word from a document and replace it with a new one, both words should be red - one underlined and one with a line through. However, both end up black, with no further style applied. Is there a way to render the formatting and if not, is there a simple way to just hide the change tracking?

Bonus question: Is there a way to render word comments when saving to XPS?

Aspose version: 9.5.0

Morten Christiansen


Thanks for your request. To hide revisions in the document, you should just accept all revisions in the document before converting it to XPS. Please see the following code:

// Open document.

Document doc = new Document(@"Test001\Aspose+test.doc");

// Accept all revisions in the document.


// Save output as XPS.


Hope this helps.

Unfortunately, currently there is no way to render comments and revision marks using Aspose.Words. In one of future versions of Aspose.Words we will consider adding an ability to show revisions and comments in the rendered documents (PDF, XPS, SWF, Image). Your request has been linked to the appropriate issue. We will let you know once this feature is available.

Best regards,

Thanks for the response. Looking a bit at the document model, I did find a very workable solution. The following code renders something similar to the formatting used in Word:

        public static void ApplyTrackChangesFormatting(Document document)
if (!document.HasRevisions)

foreach (var run in document.GetChildNodes(NodeType.Run, isDeep: true).Cast())
var inline = run as Inline;
if (inline == null)

if (inline.IsDeleteRevision)

if (inline.IsInsertRevision)

if (inline.IsDeleteRevision || inline.IsInsertRevision)

private static void AddInsertFormatting(Inline inline)
inline.Font.Color = Color.Red;
inline.Font.Underline = Underline.Dotted;
inline.Font.UnderlineColor = Color.Red;

private static void AddDeleteFormatting(Inline inline)
inline.Font.Color = Color.Red;
inline.Font.StrikeThrough = true;

private static void AddParagraphChangeFormatting(Inline inline)
var border = inline.ParentParagraph.ParagraphFormat.Borders.Left;
border.LineWidth = 1;
border.LineStyle = LineStyle.Single;
border.Color = Color.Black;
border.DistanceFromText = 10;
One little issue is that Word marks each modified line with a border to the left where I can only get it to mark the entire paragraph. For comments, I guess I’ll have to implement a custom way to render them unless there is a good way to annotate the document model as I did above.

Hi Morten,

It is perfect that you managed to find a workable solution. Please feel free to ask in case of any issues, we will be glad to assist you.

Best regards,


Just wanted to say thanks for your solution. It was exactly what I needed. Aspose should really integrate it into their next release. Others could definitely benefit from your code.


The issues you have found earlier (filed as WORDSNET-2121) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Could be implemented also via Visitor - feed your custom DocumentVisitior to Document. And catch every Run in overriden VisitRun method. Similar to foreach, but a bit more elegant.

Hi Dmitry,

Thanks for the additional information. Rest assured, we will keep you informed of any developments and let you know via this forum thread once the remaining issue (WORDSNET-2120) is resolved.

Best Regards,

The issues you have found earlier (filed as WORDSNET-2120) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.