[AccessD] Writing raw RTF document using VBA

Gustav Brock gustav at cactus.dk
Fri Oct 31 11:33:38 CST 2003


Hi all

The client has got new budgets and is again asking for this:

> My simple need (which I never got solved) was how to assemble an
> rtf-formatted field from many records (essentially each an rtf
> document) into one rtf document, stripping headers etc. from each
> record and adding a header etc. to the final document.

Does anybody have a clue how to attack it?

It is for assembling a catalogue where each item in Access has it own
small description in formatted text (bold, underline, sub/sup script
only) into one rtf document which are read by the dtp people.

Basically the task is to strip the header and the tail from the small
rtf strings, concatenation these, then adding one header and one tail
to create one finished document.

/gustav


> I once located these links to a compact list of codes (not sure of the
> version) and some simple code examples:

>   http://thorkildsen.no/faqsys/docs/rtf.txt

>   http://www.codeguru.com/forum/showthread.php?threadid=233068

> My simple need (which I never got solved) was how to assemble an
> rtf-formatted field from many records (essentially each an rtf
> document) into one rtf document, stripping headers etc. from each
> record and adding a header etc. to the final document.

> So if you come up with a routine for parsing an rtf string, at least
> extracting the content including bold, underline, and italic
> attributes, I would be pleased to see it.

> Here's a link to a class in RealBasic for parsing a subset of rtf
> formatted text. I guess you can download a trial version of RealBasic
> to study it:

>   http://www.belle-nuit.com/realbasic/rtfparser.html

> In Java life is easier:

>   http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/text/rtf/RTFEditorKit.html

> /gustav


>> Bryan's link points to v1.6 of the RTF spec.  But, if you're interested, I
>> was poking around and found a download link (watch for wrap) for v1.7.

> http://www.microsoft.com/downloads/details.aspx?FamilyId=E5B8EBC2-6AD6-49F0-8C90-E4F763E3F04F&displaylang=en

>> Mark


>> RTF Files are just plain old ascii text. So Low level File I/O will work to
>> write it.

>> The biggest challenge would be to get the text string correct before writing
>> them out to the file.

>> Here is a link to the RTF spec.

> http://msdn.microsoft.com/library/?url=/library/en-us/dnrtfspec/html/rtfspec.asp?frame=true

>> As for PDF, here is the link to the PDF Specs.

> http://partners.adobe.com/asn/acrobat/docs.jsp#filefmtspecs

>> Bryan Carbonnell
>> bryan_carbonnell at cbc.ca



More information about the AccessD mailing list