Sub EmitRTFFileHeader (FileNum As Integer) ' Generate RTF file header using passed file number ' Assumes that the file has been previously opened successfully ' Emit RTF file identifier, character set, etc. Print #FileNum, "{\rtf1\ansi \deff0\deflang1024" ' Generate a minimal font table containing just enough ' fonts to support Windows and Macintosh viewing Print #FileNum, "{\fonttbl" Print #FileNum, "{\f0\froman Times New Roman;}" Print #FileNum, "{\f1\froman Symbol;}" Print #FileNum, "{\f2\fswiss Arial;}" Print #FileNum, "{\f3\fswiss Helvetica;}" Print #FileNum, "{\f4\fswiss Hel;}" Print #FileNum, "}" ' Generate a minimal color table consisting of black, ' blue, green, red, and white. Print #FileNum, "{\colortbl;" Print #FileNum, "\red0\green0\blue0;" Print #FileNum, "\red0\green0\blue255;" Print #FileNum, "\red0\green255\blue0;" Print #FileNum, "\red255\green0\blue0;" Print #FileNum, "\red255\green255\blue255;" Print #FileNum, "}" ' Set the default font to Times New Roman Print #FileNum, "\deff0" ' Generate an initial topic separator Print #FileNum, "\page" End Sub Sub EmitRTFFootnote (FileNum As Integer, FootnoteChar As String, FootnoteBody As String) ' Routine to emit RTF footnote record. ' Assumes output file has been previously opened as #FileNum. ' Superscripting of FootnoteChar is not really necessary ' but looks nicer if RTF file is read into WinWord later. Print #FileNum, FootnoteChar + "{\footnote "; Print #FileNum, "{\fs16\up6 " + FootnoteChar + "} "; Print #FileNum, FootnoteBody + "}" End Sub Sub EmitRTFTabStop (FileNum As Integer, TabStop As Integer) ' The RTF \tx command parameter and thus the TabStop parameter for ' this subroutine is given in twips. 1440 twips = one inch. Dim Str1 As String Str1 = "\tx" & LTrim$(Str$(TabStop)) & " " Print #FileNum, Str1 End Sub Sub EmitRTFTopicDivider (FileNum As Integer, TopicHeading As String, ContextString As String, TitleFootnote As String, BrowseSequence As String) ' This routine emits the RTF code to begin a new "topic". ' The code consists of a "page break" command followed by ' footnotes for the topic's context string, title footnote ' for history list, and browse sequence, followed by the ' topic heading which appears in a nonscrolling region in ' 14 pt. type. Default paragraph formatting and font are ' then restored. ' signal start of new viewer topic Print #FileNum, "\page" ' write context string footnote as label for this topic Call EmitRTFFootnote(FileNum, "#", ContextString) ' write title footnote to be used in history ' window and (for multimedia viewer) in search dialogs Call EmitRTFFootnote(FileNum, "$", TitleFootnote) ' write browse sequence number footnote Call EmitRTFFootnote(FileNum, "+", BrowseSequence) ' Write the topic header text, using the keep with next ' attribute to put the header in a nonscrolling window Print #FileNum, "\keepn \f2\fs28 "; Print #FileNum, TopicHeading Print #FileNum, "\par " ' Restore default paragraph formatting and font Print #FileNum, "\pard \f2\fs20 {\dtype}" End Sub Sub EmitRTFTrailer (FileNum As Integer) ' Routine to generate RTF file trailer. ' Just emits RTF codes to close out the current ' paragraph if any and then close out the current ' topic, following all with a closing brace to ' balance the initial brace written by the ' EmitRTFHeader routine. Print #FileNum, "\par" Print #FileNum, "\page" Print #FileNum, "}" End Sub