Alan Mead cubrewer at yahoo.com
Mon Jun 28 18:25:19 CEST 2004

--- David G Jenkins <davidgjenkins at ntlworld.com> wrote:
> rtfpars
>      Contains a RTF (Rich Text Format) parsing class. All that
> needs to 
> be done is set some event handlers and you can display RTF wherever
> you 
> want.
> I would like to use this to generate RTF files but don't have any 
> documentation about the functionality of this unit.

I can't help with rtfpars but I have had luck in the past using
templates.  RTF is pretty complicated and so constructing brand-new
documents from scratch might be complex.  But if you just need to
create a single kind of document, perhaps with some data changed,
then you can often solve the problem much more simply by:  (1) create
an RTF document in your favorite software; (2) Insert tags like
##ADDRESS1## where you want to substitute text; (3) read in the
template and replace the tags with the text of your choice.

If you have more slightly more complex needs... such as wanting to
insert the text of a letter, then the RTF that marks up standard text
is pretty simple, so:  (1) create the RTF file; (2) break it into a
"header" part and a "tail" part; (3) examine the simple mark-up for
the body and write your conversion routine.

This approach has some advantages: it's quick and relatively simple
and it practically garuantees that the generated RTF can be read
properly by your favorite software.  But it can also be really
cumbersome to change the template and it doesn't work if you need the
fancy RTF features.

There used to be a thick-ish RTF spec on the microsoft.com website
that you could examine if you wanted a better understanding of RTF.


More information about the fpc-pascal mailing list