How to hide highlighted text in Word document using C#

Dear Support!

I would like to hide the text in the word document if it is highlighted using C# aspose.words.
Thank you so much!
Attached sample file.HideHighlight_test_file.zip (13.9 KB)

@NszolnokiMQ

You can use the following code example to find the highlighted text and set font formatting as hidden. Hope this helps you.

Document doc = new Document(MyDir + "HideHighlight_test_file.docx");
foreach (Run run in doc.GetChildNodes(NodeType.Run, true))
{
    if (run.Font.HighlightColor != Color.Empty)
        run.Font.Hidden = true;
}

doc.Save(MyDir + "20.8.docx");
1 Like

@tahir.manzoor
Thank you so much, you are awesome!