Bulk Replace Bold, Italicized Text with HTML Markups

A Word document with many bold, italicized or underlined text needs to be transferred faithfully to a web page with its various markups. Copying and pasting the text to a WYSIWYG HTML Editor, followed by adding emphasis to the respective span of text one by one, is not efficient enough.

This article describes a method to bulk replace bold, italicized text with HTML markups before copying and pasting the Word document.

Steps

You can download this Word document to follow through with the steps below.

  1. Open the Word document. There are 2 bold text, 1 italicized text and 3 underlined text as shown below.
  2. Click Replace to bring up the Find and Replace dialog window. Check that the cursor is inside the Find what textbox.
  3. Click the More button, then click the Format button.
  4. From the dropdown menu, select Font to bring up the Find Font dialog window.
  5. Select Bold under Font style. Click the OK button.
  6. Under “Find What” section, the format is listed as “Font: Bold”. Within the text box for “Replace with”, enter “<strong>^&</strong>”. Alternatively, you can enter “<b>^&</b>” or “<span style=”font-weight:bold”>^&</span>”.
  7. Click the Replace All button and now <strong> HTML tags will be wrapped around the 2 bold text.
  8. To bulk replace italicized text, repeat Step 2 to 4, then select italic from the menu under Font style. Click the OK button.
  9. Under “Find What” section, the format is listed as “Font: Italic”. Within the text box for “Replace with”, enter “<em>^&</em>”. Alternatively, you can enter “<i>^&</i>” or “<span style=”font-style: italic”>^&</span>”. Click Replace All.
  10. To bulk replace underlined text, repeat Step 2 to 4. Delete the Italic or Bold selected inside Font Style using the keyboard’s Backspace or Delete key. Select the line underline under Underline style, as shown below. Then click the OK button.
  11. Under “Find What” section, the format is listed as “Underline”. Within the text box for “Replace with”, enter “<u>^&</u>”. Alternatively, you can enter “<span style=”text-decoration: underline;”>^&</span>”. Click Replace All.
  12. Please note that Step 11 will add <u> tags to hyperlinks in addition to underlined text. To exclude hyperlinks, you need to select just the portion of the Word document where you want the Find/Replace operation to occur before commencing Step 2.

The Word document with the HTML tags added can be downloaded here.