Here is some code that I use to create an RTF, attach it to an email, mail it
to client...(from a form, recordset whatever on the server).
<!--- Step 1. Read the RTF file into a variable
Step 2. merge the form data into it
Step 3. write the file to the filesystem then email it
--->
<!--- Step 1&2. Read the RTF file into a variable --->
<cfset ThisFolder = GetDirectoryFromPath(GetCurrentTemplatePath())>
<cfset TemplatePath = ThisFolder & "THCU_Consultation_Planning_Form.rtf">
<cfset PDFTemplatePath = ThisFolder & "THCU_Consultation_Planning_Form.pdf">
<cffile action="read"
file="#TemplatePath#"
variable="rtf">
<!--- replace placeholder text with form content --->
<cfset RTF = Replace(RTF, "%request_dt%",
DateFormat(rs_Plan.request_dt, "dd mmm yyyy"))>
<cfset RTF = Replace(RTF, "%parentID_fk%",
rs_Plan.parentID_fk)>
<cfset RTF = Replace(RTF, "%firstname%",
rs_Plan.firstname)>
<cfset RTF = Replace(RTF, "%lastname%",
rs_Plan.lastname)>
<cfset RTF = Replace(RTF, "%organization%",
rs_Plan.organization)>
<cfset RTF = Replace(RTF, "%email%", rs_Plan.email)>
<cfset RTF = Replace(RTF, "%time_frame%",
rs_Plan.time_frame)>
<cfset RTF = Replace(RTF, "%num_participants%",
rs_Plan.num_participants)>
<cfset RTF = Replace(RTF, "%request_description%",
rs_Plan.request_description)>
<cfset RTF = Replace(RTF, "%outcomes%", new_outcomes)>
<cfset RTF = Replace(RTF, "%desired_outcomes%",
rs_Plan.desired_outcomes)>
<cfset RTF = Replace(RTF, "%other_outcome%",
rs_Plan.other_outcome)>
<cfset RTF = Replace(RTF, "%client1%", rs_Plan.client1)>
<cfset RTF = Replace(RTF, "%client2%", rs_Plan.client2)>
<cfset RTF = Replace(RTF, "%client3%", rs_Plan.client3)>
<cfset RTF = Replace(RTF, "%client4%", rs_Plan.client4)>
<cfset RTF = Replace(RTF, "%client_contribution%",
rs_Plan.client_contribution)>
<cfset RTF = Replace(RTF,
"%client_contribution_other%", rs_Plan.client_contribution_other)>
<cfset RTF = Replace(RTF, "%notes%", rs_Plan.notes)>
<cfset RTF = Replace(RTF, "%submitdate%",
DateFormat(CreateODBCDate(Now())," dd mmm yyyy"))>
<cfset RTF = Replace(RTF, "%consultant%",
rs_Plan.consultant)>
<!--- Step 3. Write file out to file system --->
<cfset NewTemplatePath = ThisFolder & "THCU_Consultation_Planning_Form-" &
rs_Plan.plan_ID & ".rtf">
<cffile action="write"
file="#NewTemplatePath#"
output="#rtf#">
> > Unfortunately I am still looking for answers for this one.
> > ________________________________
> >
> > From: Doug Allan [mailto:[EMAIL PROTECTED]
> > Sent: Fri 03/06/2005 21:15
> > To: CF-Talk
> > Subject: Web Based Mail Merge? (not email!)
> >
> >
> >
> > This is a response to the original post by Andy McShane http://www.
> > houseoffusion.com/lists.cfm/link=m:4:39361:201256
> >
>
>
> Does anyone think the CF Report Builder could be used to accomplish
> this. I read a tutorial on the macromedia site where the report
> builder was used to print avery address labels http://www.macromedia.
> com/devnet/mx/coldfusion/articles/averylabels.html
>
> There wasn't a clear mention of a mail-merge but it sounded feasible.
> Anybody have any thoughts? Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210741
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