How to combine multiple RTF files into a single file using CF
Posted on 2004-08-12
I need to join multiple RTF files into a single RTF to accomodate a need for batch printing, ect. I have tried all sorts of things to make this happen and what I keep ending up with is a combined RTF that has only the first file in it. I have tried things like:
Writing a new blank rtf (combined.rtf)
Reading the first file
Appending the first file to the combined.rtf
Reading the second file
Appending the second file to the combined.rtf ...
When I do this, I only get the first file read or appended
I also tried things around ----
Read the first file into a variable
Read the second file into another variable
<cfset combined = '#firstFile#' & '#SecondFile#'>
Write the combined.rtf with the variable #combined#
I get the same thing. Which ever file is in the combined string's first postion is what I see in the resulting rtf
I also tried appending a "/page " to the first file hoping that this would provide a page break.
It appears to me that the combined rtf is reaching an 'end of file' flag before getting to the second file. Also, I'm not sure how all the leading formatting stuff might play into this.
There must be a simple answer to this but I don't see it so, any help is appreciated.