Professional Web Applications Themes

Generating Word docs dynamically - Coldfusion - Advanced Techniques

Hi I am trying to generate a word doent on the fly and then attach this to an e-mail using the code attached. However at present on my screen I am getting just text output and an error stating that the 'The resource Retirememo.doc was not found' Any ideas on a solution to solve these two problems and can it be achieved? <cfset ian = "Ian"> <cfset thisFolder = getDirectoryFromPath(getCurrentTemplatePath())> <cfset templatePath = thisFolder & "DocTemplate.rtf"> <cffile action="read" file="#templatePath#" variable="rtf"> <cfset todaysdate = dateformat(Now(), "dd, mmmm, yyyy")> <cfset rtf = replace(rtf, "%CurrentDate%", todaysDate,"ALL")> <cfset rtf = replace(rtf, "%namefirst%", ian,"ALL")> <cfheader ...

  1. #1

    Default Generating Word docs dynamically

    Hi

    I am trying to generate a word doent on the fly and then attach this to an
    e-mail using the code attached. However at present on my screen I am getting
    just text output and an error stating that the 'The resource Retirememo.doc was
    not found'

    Any ideas on a solution to solve these two problems and can it be achieved?

    <cfset ian = "Ian">
    <cfset thisFolder = getDirectoryFromPath(getCurrentTemplatePath())>
    <cfset templatePath = thisFolder & "DocTemplate.rtf">

    <cffile action="read" file="#templatePath#" variable="rtf">

    <cfset todaysdate = dateformat(Now(), "dd, mmmm, yyyy")>

    <cfset rtf = replace(rtf, "%CurrentDate%", todaysDate,"ALL")>
    <cfset rtf = replace(rtf, "%namefirst%", ian,"ALL")>


    <cfheader name="Content-Disposition" value="attachment;
    filename=Retirememo.doc">
    <cfcontent type="application/msword"><cfoutput>#rtf#</cfoutput>

    <cfmail to="com"
    from="com"
    subject="Test"
    type="HTML">

    <cfmailparam file="Retirememo.doc">
    Please find attached
    </cfmail>

    rambo Guest

  2. #2

    Default Re: Generating Word docs dynamically

    rambo wrote: 

    cfmailparam takes an existing disk file as an argument. You need to save
    your content to a file and then attach it to the e-mail.

    --
    <mack />


    Neculai Guest

  3. #3

    Default Re: Generating Word docs dynamically

    Also, this will display the doent to the screen, but not send the email. Cfcontent stops all other processing after it on a CF page.
    HairyDude Guest

  4. #4

    Default Re: Generating Word docs dynamically

    Ok I have the word doent loading using the code attached, however is there
    any workarounds where you can either

    1.) Save this newly created word doc onto your webserver automatically

    or

    2.) Attach the word doc to an e-mail automatically?

    rambo Guest

Similar Threads

  1. Dynamically generating CSS classes
    By Nathan in forum ASP.NET Building Controls
    Replies: 2
    Last Post: December 23rd, 05:25 PM
  2. MTB-How to convert multiple .pdf docs to MS Word docs all at same time.
    By Michael_Burgett@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 1
    Last Post: May 5th, 05:39 PM
  3. Word docs go from 28k to 1000+k
    By jeff in forum Mac Applications & Software
    Replies: 6
    Last Post: October 1st, 11:02 PM
  4. dynamically generating graphics
    By MJL in forum PERL Miscellaneous
    Replies: 2
    Last Post: September 17th, 07:02 AM
  5. Dynamically generating multi-table SQL
    By J. Gleixner in forum PERL Miscellaneous
    Replies: 7
    Last Post: July 17th, 04:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139