When I use CF to create "mail merge" type form letters, I first set up my 
format characters as a block of variables, like this:

<!--- Generic formatting variables. --->
<cfset crlf = "#chr(13)##chr(10)#"> <!--- carriage return, line-feed --->
<cfset cr = "#chr(13)#"> <!--- carriage return --->
<cfset lf = "#chr(10)#"> <!--- line-feed --->
<cfset tab = "#chr(9)#"> <!--- tab --->
<cfset dblquote = "#chr(34)#"> <!--- double-quote --->
<cfset pgbrk = "#chr(12)#"> <!--- page break --->
<cfset topmargin = "#lf##lf##lf##lf##lf##lf##lf#"> <!--- page break --->

<cfset ResidentLtrs = "">

Then I just loop over the query with the data for the variables and build a 
variable with the letter text, like this:

<cfset ResidentLtrs = ResidentLtrs & #topmargin# & 
#DateFormat(qAnnexLookup.Anx_Date, "mmmm d, yyyy")# & #crlf# & #lf# & "New City 
Resident" & #crlf# & #oldstAddr# & #crlf# & "Renton, WA  " & 
#qOwnerPIDs.ZipCode# & #crlf# & #lf# & "SUBJECT:  " & #qAnnexLookup.Name# & " 
ADDRESS CHANGES" & #crlf# & #lf# & "Because of the recent annexation of your 
property at " & #oldstAddr# & " to the City of Renton, the address must be 
changed to correspond with the City's address system. The new address is:" & 
#crlf# & #lf# & #tab# & #tab# & #tab# & #newStAddr# & #crlf# & #lf# & "In an 
endeavor to assist you through this transition, I have notified the local 
Postal Authority and the utility companies, as well as the attached list of 
other potential agencies. When you submit the enclosed card to the Post Office 
you will receive an information packet to assist in this notification." & 
#crlf# & #lf# & "Please post your new address numbers within 30 days and at a 
minimum size of 4" & #dblquote# & " (four inches)." & #crlf# & #lf# & "If you 
have further questions, please contact me at (123) 456-7890." & #crlf# & 
"Welcome to the City of Renton!" & #crlf# & #lf# & "Sincerely," & #crlf# & #lf# 
& #lf# & #lf# & "Joe Schmoe" & #crlf# & "Development Services Representative" & 
#crlf# & "Development Services Department" & #crlf# & #pgbrk#>

After the loop, use cffile to write the variable contents to a file with a 
".doc" file extension, then provide a link on the following display page for 
the user to download the file. It's not perfect; the user may need to set the 
font and tab stops for the document. But even so, it sure is a time saver for 
the users and it is pretty easy to do from a programming standpoint!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201439
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to