DOCX with tracked changes converted to HTML missing revision markup

Hello,
When converting DOCX to HTML using SaveFormat.Html, the output markup is partially missing:

  • revision text effects are not correct (e.g. missing double strikethrough)
  • moves are not marked up at all

When using SaveFormat.HtmlFixed, however, it looks correct:

Is there a way to make SaveFormat.Html use correct revision markup?

We are using Aspose.Words 25.2.0. Sample code below.

var document = new Document("revision.docx");

var revisionOptions = document.LayoutOptions.RevisionOptions;

revisionOptions.ShowRevisionMarks = true;

revisionOptions.DeletedTextColor = RevisionColor.ClassicRed;
revisionOptions.InsertedTextColor = RevisionColor.ClassicBlue;
revisionOptions.MovedFromTextColor = RevisionColor.BrightGreen;
revisionOptions.MovedToTextColor = RevisionColor.LightGreen;

revisionOptions.DeletedTextEffect = RevisionTextEffect.DoubleStrikeThrough;
revisionOptions.InsertedTextEffect = RevisionTextEffect.DoubleUnderline;
revisionOptions.MovedFromTextEffect = RevisionTextEffect.StrikeThrough;
revisionOptions.MovedToTextEffect = RevisionTextEffect.Underline;


document.Save("revision.html", SaveFormat.Html);

revision.docx (15.2 KB)

@draftable

When converting a DOCX document to HTML using SaveFormat.Html, it appears that certain revision markup, such as double strikethrough for deleted text and movement markings, may not be rendered correctly. This is a known limitation when using the HTML format, as it does not fully support all the revision features available in the DOCX format.

However, when you use SaveFormat.HtmlFixed, the output retains the correct revision markup, which indicates that this format is better suited for preserving the visual representation of revisions.

To ensure that the revision markup is correctly displayed in the HTML output, you might consider the following approaches:

  1. Use SaveFormat.HtmlFixed: If the visual fidelity of the document is critical, continue using SaveFormat.HtmlFixed for your conversions, as it maintains the appearance of revisions more accurately.

  2. Check Revision Options: Ensure that the revision options are set correctly in your code. You have already set various properties for revision colors and effects, which is good. However, keep in mind that not all effects may be supported in the HTML format.

  3. Post-Processing HTML: If you need to stick with SaveFormat.Html, consider post-processing the generated HTML to manually add the missing revision markup. This could involve using JavaScript or CSS to visually represent the revisions as needed.

Here is a sample code snippet that demonstrates how to set up the revision options before saving the document:

var document = new Document("revision.docx");

var revisionOptions = document.LayoutOptions.RevisionOptions;

revisionOptions.ShowRevisionMarks = true;
revisionOptions.DeletedTextColor = RevisionColor.ClassicRed;
revisionOptions.InsertedTextColor = RevisionColor.ClassicBlue;
revisionOptions.MovedFromTextColor = RevisionColor.BrightGreen;
revisionOptions.MovedToTextColor = RevisionColor.LightGreen;

revisionOptions.DeletedTextEffect = RevisionTextEffect.DoubleStrikeThrough;
revisionOptions.InsertedTextEffect = RevisionTextEffect.DoubleUnderline;
revisionOptions.MovedFromTextEffect = RevisionTextEffect.StrikeThrough;
revisionOptions.MovedToTextEffect = RevisionTextEffect.Underline;

document.Save("revision.html", SaveFormat.Html);

If you continue to experience issues with the HTML output, it may be beneficial to reach out to Aspose support for further assistance or to check for updates in newer versions of the library that may address these limitations.

Sources:

  • No specific sources were referenced in this response.

@draftable Unfortunately, Aspose.Words does not support export format and move revisions to flow HTML. Only insert and delete revisions are currently supported. I have linked your request to the appropriate issues:
WORDSNET-16331 - move revisions support
WORDSNET-25077 - format revisions

LayoutOptions.RevisionOptions has effect only while exporting document to fixed page formats, like PDF, XPS, Image, HtmlFixed etc. These options does not affect output to flow HTML.