Insert HTML tags for underlining ("<U>...</U>"), bold ("<B>...</B>"), or italics ("<I>...</I>"), and then use a macro after assembly to search out the tags and actually apply the formatting. This macro is executed using a HotDocs "PLAY" instruction inserted at the end of the document.
I'll just sketch out underlining here--bold and italics are very similar. For underlining "tags" I chose to use the respective HTML commands <U> to start and </U> to end, but they could be anything. The text that needs to be underlined is surrounded by these tags, as follows:
SET TextVariable TO "<U>This is underlined text</U>"
The macros used to actually apply the formatting follow.
• • • • • • •
Microsoft Word macro code: (kept in a template in the Office Startup folder to make it globally available) With Selection ' Set up common .Find properties .Find.ClearFormatting .Find.Forward = True .Find.Wrap = wdFindStop .Find.Replacement.ClearFormatting .Find.Replacement.Text = "" ' empty string ' Handle the underlining .HomeKey unit:=wdStory While .Find.Execute(FindText:="<U>", MatchCase:=False) .Delete .Extend If .Find.Execute(FindText:="</U>", MatchCase:=False) Then .MoveLeft unit:=wdCharacter, Count:=4 ' left of "</U>" .Font.Underline = wdUnderlineSingle .Collapse wdCollapseEnd .Delete unit:=wdCharacter, Count:=4 ' delete "</U>" End If Wend ' While .Find.Execute() End With
For Bolding and Italics, repeat this from ".HomeKey" to "Wend" (within the "With Selection" and "End With), looking for appropriate tags (I used <B></B> and <I></I>) and setting ".Font.Bold = True" and ".Font.Italic = True".
• • • • • • •
WordPerfect macro code: (paste it into a WordPerfect document and save it as "format.wcm" in your macro directory; invoke it with «PLAY "format.wcm"») Prompt ("Format"; "Applying formatting. Please wait ..."; NoButtons!) NotFound (Off!) Error (Off!) Display (Off!) SearchInSelection (No!) SearchWrap (No!) SearchCaseSensitive (No!) SearchFindWholeWordsOnly (No!) MatchLimit (No!) MatchWithAttributes (No!) MatchWithFont (No!) MatchWithFontSize (No!) // Search out each of the following tags: // <U>...</U> - underline // <B> ... </B> - bold // <I> ... </I> - italics ForEach (vType; {"U"; "B"; "I"}) PosDocVeryTop vTagOpen := "<" + vType + ">" vTagClose := "</" + vType + ">" Label (Again) SearchString (vTagOpen ) MatchSelection SearchNext (Extended!) If ( ?NotFound = False ) // Found one SelectDelete SearchString (vTagClose) SelectMode (On!) MatchExtendSelection SearchNext (Extended!) If (?NotFound = True) // Didn't find the end tag MessageBox (; "Error"; "One of the codes is missing") Quit EndIF // Apply the proper formatting Switch (vType) CaseOf "U": AttributeAppearanceOn (Underline!) CaseOf "B": AttributeAppearanceOn (Bold!) CaseOf "I": AttributeAppearanceOn (Italics!) EndSwitch Go (Again) EndIf PosDocVeryTop SearchString (vTagClose) ReplaceString ("") ReplaceAll (Extended!) EndFor EndPrompt PosDocTop