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

Free Support Forum - aspose.com

How to remove the custom highlighted color added to docx file using aspos.words

Hi, I have a docx document with some highlighted style added.

I wanted to remove those highlighted color from docx files while converting to html.
The resultant html should not need the highlighted styles from docx.
Anime (1).docx (15.5 KB)

im using these two methods to highlight the text in aspose

foreach (var item in paragraphWithMostHits)
    //Remove smart tags 
    var runsList = item.Where(x => x.NodeType == 1.Aspose.Words.NodeType.Run).ToList();
    item.ParagraphBreakFont.HighlightColor = System.Drawing.Color.Yellow;
    foreach (Aspose.Words.Run run in runsList)
        run.Font.HighlightColor = System.Drawing.Color.Yellow;
options.ApplyFont.HighlightColor = System.Drawing.Color.Yellow;


The document attached does not have any highlighted text. It has hyperlinks.
If what you need is to remove the hyperlinks, here is some code:

private void Logic(Document doc)
    var hyperlinkFieldList = doc.Range.Fields.Where(f => f.Type == FieldType.FieldHyperlink).Cast<Field>().ToList();            

    foreach (var hyperlink in hyperlinkFieldList)

    doc.Save($"{PartialPath}_output.html", SaveFormat.Html);

To save the result as HTML all you have to do is specify the save format. There is also an SaveOption class you can use if you need to configure some specific things. In the link provided the is an example for Html