Replace Formatting With Codes

Q: I've been struggling with this issue for years. Perhaps you have the solution. I'm converting documents into HTML files for an on-line encyclopedia. I have the need to find and replace open and close italic codes in Microsoft Word with HTML and codes, respectively. I used to be able to do this in WordStar. Right now I have to do it all manually. Unfortunately, I can't just save the Word files in HTML because doing so puts too many extraneous codes in the text to be useful in my Web page templates. I don't need to remove or change the italic formatting itself, as I copy and paste the entire group of paragraphs into my HTML editor, which ignores all formatting and just pastes the text.

I know Word does treat some control codes as characters. For example, you can use ^p for paragraph breaks and ^t for tab stops in Find and Replace. Are there any undocumented codes for italic and bold markers? — Ray Noonan

A: There's no equivalent in Word to "Reveal Codes" as in WordStar or WordPerfect. And there are no special find/replace codes for formats like bold and italic. But never fear—there's a different sort of find/replace code that will do the job for you. In the Replace with box, the code ^& represents Find what text. This means that Word replaces the code with whatever text matched your search.

Here's how you'll use it. In the Find and Replace dialog, click the More button, click the Format button, and choose Font from the menu that results. Set the font style to italic and click OK; you should now see "Font: Italic" below the Find what box. (Alternatively, you can simply press Ctrl-I in the Find what box.) Click in the Replace with box and enter ^&. Click the Replace All button and you're done. You can handle other formats the same way, substituting the proper code letters, of course.