Marco,

Basically all you need is a table structure like your example. I actually
found that your method wouldn't automatically pop up a "save as Excel"
dialog box in all browsers. What I ended up doing was simply did a save
content to a variable (<cfset ...>) and

    <cfheader name="Content-Disposition" value="attachment;
filename=FormData.xls" />
    <cfcontent type="application/msexcel" variable="#myHTML#" />

If you go this route though, be aware that for larger files where you might
be running cfset often, you might want to switch to a Java class object:

    <cfset myHTML = createObject("java","java.lang.StringBuffer")>

And then you would do

    <cfset myHTML.append("<tr>")>

And your final cfcontent tag would look like:

    <cfcontent type="application/msexcel" variable="#ToBinary( ToBase64(
totalHTML.Trim() ) )#" />
To get it back to a normal string type. I found the above hint on some blog
about coldfusion after I found that things were going very slowly for a 20
row excel output. Doing things with the stringbuffer was much faster
(although I don't know about the 'safety' of working with a more primitive,
as I understand, class)

Best,

Tomek

On Sun, Nov 2, 2008 at 9:34 PM, Marco van den Oever <
[EMAIL PROTECTED]> wrote:

>
> Hereby a simple method:
>
> <cfcontent type="application/vnd.ms-excel">
>    <h2>Polling statistics: #stprops_pollingdata.question#</h2>
>    <table border="1" cellpadding="1" cellspacing="2">
>      <tr>
>        <th>Date / Time created</th>
>        <th>Question</th>
>        <cfloop index="i" from="1" to="#application['wsoFarcryPolling'
> & pollingid]#">
>          <cfif stprops_pollingdata['answer' & i] GT 0>
>            <th>#stprops_pollingdata['answer' & i]#</th>
>          </cfif>
>        </cfloop>
>        <th>Total votes</th>
>      </tr>
>      <tr>
>        <td>#stprops_pollingdata.datetimecreated#</td>
>        <td>#stprops_pollingdata.question#</td>
>        <cfloop index="i" from="1" to="#application['wsoFarcryPolling'
> & pollingid]#">
>          <cfif stprops_pollingdata['answer' & i] GT 0>
>            <td>#sums[i].recordcount#</td>
>          </cfif>
>        </cfloop>
>        <td>#answers_sum#</td>
>      </tr>
>    </table>
>
> On Nov 3, 12:57 am, Marco van den Oever <[EMAIL PROTECTED]>
> wrote:
> > Is there a function to put db data in Excel???
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to