TRtfFile - RTF/HPJ Help Document Generator

Fuente: source/classes/rtffile.prg

TRtfFile generates Rich Text Format (.RTF) files suitable for compiling into Windows Help (.HLP) files with the Microsoft Help Workshop (HCW.EXE). It produces short and long topic entries, jump and popup links, bitmap references, topic IDs, see-also lists, and page breaks, all in valid RTF syntax that the Help Compiler understands.

Methods

MethodDescription
New( cFile )Create a new RTF file with the standard help header (footnote formatting)
WriteShort( cText, cJump, lPopup, cBmp )Write a short topic. cText is displayed; cJump is the context string; lPopup specifies popup vs. jump; cBmp optionally embeds a bitmap
WriteLong( cText )Write a long topic paragraph of body text
WriteId( cId )Write a # footnote with the topic ID string (used as the context name for jumps)
WriteSeeAlso( cList )Write a $ footnote with a "Ver También" list of related topic titles
NewPage()Insert a page break (form-feed) to separate topics in the RTF
End()Finalize the RTF file with closing braces and close it

Example: Generate a Help Topic File

#include "FiveWin.ch"

function Main()

   local oRtf := TRtfFile():New( "help.rtf" )

   // First topic: Introduction
   oRtf:WriteId( "INTRO" )
   oRtf:WriteShort( "Welcome to MyApp", "INTRO", .F., "" )
   oRtf:WriteLong( "This is the introduction to MyApp." )
   oRtf:WriteLong( "Click below for more information." )
   oRtf:WriteSeeAlso( "Installation|Configuration" )
   oRtf:NewPage()

   // Second topic: Installation
   oRtf:WriteId( "INSTALL" )
   oRtf:WriteShort( "Installation Guide", "INSTALL", .F., "" )
   oRtf:WriteLong( "Follow these steps to install MyApp." )
   oRtf:WriteSeeAlso( "Introduction" )
   oRtf:NewPage()

   oRtf:End()
   MsgInfo( "Help file help.rtf generated" )

return nil