Find all the bold words and tag it RRS feed

  • Question

  • I need to tag string in bold, Underlined, Italics.
    Example :
    Input : This strings are not in bold but this string are in bold.This is italics.

    Expected Output:

    This strings are [u]not in bold[/u] but [b]this string are in bold[/b].[i]This is italics[/i]

    on using the below code, individual words are getting tagged instead of sentence like this [b] Home [/b] [b] Page [/b]/[b] Dashboard [/b] but expected is like [b] Home Page /Dashboard [/b]

    Microsoft.Office.Interop.Word.Range rngFindBold = doc.Content; rngFindBold.Find.Font.Bold = -1; //true

    rngFindBold.Find.Execute(FindText: "(<*>)", Format: true, ReplaceWith: " ^& ",Wrap:Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue, MatchWildcards: true, Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);

    Please help me out on this.

    Thanks in advance.

    Monday, August 5, 2019 9:49 PM