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

Free Support Forum - aspose.com

Underline a text in a paragraph in word document

Hi, I have a word document that is being generated using Aspose in c#.

I have a requirement to underline a text in a paragraph, for example i have below paragraph

In the paragraph i want the text “survived not only five centuries” as underlined, how can i achieve that using aspose c#, i am using Apsose version 3

" Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged."

@Sharath_kavayah

We suggest you please read the following article.
How to Find and Highlight Text

You can use the same code example shared in the above article to find the desired text and set font formatting as underline.

You just need to replace run.Font.HighlightColor = Color.Yellow; with
run.Font.Underline = Underline.Single; to get the desired output. Hope this helps you.