We're sorry Aspose doesn't work properply without JavaScript enabled.

# Converting RTF to HTML Doesn't Capture All Tracked Changes

I have an RTF file with tracked changes. I included deleted text, inserted text, and reformatted text (bold, italics, underline) in the tracked changes. When I save the document as HTML only the inserted text and the deleted text is properly rendered … new text is underlined and red, deleted text is struck through and red.

The formatting changes are ignored. The rendered HTML displays the original formatting with no indication of any tracked change.

How can I get the updated format to display in the HTML output and have it highlighted as a change?
Here is the relevant piece of code, where ‘document’ contains the input RTF document …

RevisionOptions ro = document.getLayoutOptions().getRevisionOptions();
ro.setRevisedPropertiesColor(RevisionColor.BLUE);
ro.setRevisedPropertiesEffect(RevisionTextEffect.UNDERLINE);

final HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setExportImagesAsBase64(true);
saveOptions.setCssStyleSheetType(CssStyleSheetType.INLINE);
saveOptions.setSaveFormat(SaveFormat.HTML);

final ByteArrayOutputStream os = new ByteArrayOutputStream();
document.save(os, saveOptions);


@stsdan Upon exporting to Flow HTML only insert and delete revisions are supported.
LayoutOptions.RevisionsOptions have effect only upon converting to fixed page formats (PDF, XPS, FixedHtml etc). So if your goal is HTML that visually looks exactly as the input document in MS Word, you can consider using HtmlFixed format:

Document document = new Document("C:\\Temp\\in.docx");

HtmlFixedSaveOptions opt = new HtmlFixedSaveOptions();
opt.setExportEmbeddedFonts(true);
opt.setExportEmbeddedCss(true);
opt.setExportEmbeddedImages(true);
opt.setExportEmbeddedSvg(true);

document.save("C:\\Temp\\out.html", opt);