[thelist] Exporting data to Word (RTF, actually) from ColdFusion

David Shadovitz david_shadovitz at xontech.com
Wed Dec 13 16:03:06 CST 2000


Some of the ColdFusion programmers out there may be exporting data to
Word (RTF, actually) as per
http://tech.irt.org/articles/js154/index.htm.  I use this method to
create a "printable page" with a header and footer on each page.

Here's a tip related to that:

<tip type="RTF" author="David Shadovitz">

If you pass a string variable containing a "<br>"  to an RTF file, it'll
display "<br>" instead of actually doing a carriage return.  Simple, I
hear you saying, just replace the <br> with CRLF, chr(13) & chr(10).
Nope, didn't work.

So I made a small RTF file, read it in via CFFILE, and printed each
character and its ASCII code.  I saw that a new line is equivalent to
the 6 characters CRLF\par, or chr(13) chr(10) chr(92) chr(112) chr(97)
chr(114).

So there you go.  Replace "<br>" with "chr(13) & chr(10) & chr(92) &
chr(112) & chr(97) & chr(114)".

</tip>

(Also posted to CF-Talk.)







More information about the thelist mailing list