• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Urgent!!!!!!!!! export to excel

I've having problem to export to excel on web. when user open the file.

Name, age
Smith Hunter  35

This will become three clolumns. it should be Smith,Hunter 35

Can someone tell me how to do the query?

select '"' name ||'",||age

#name,#age (also it seems that it couldn't find name and age from the query
0
nightworker
Asked:
nightworker
1 Solution
 
mrichmonCommented:
Simply create a table in the page

-----------------------------------
<cfquery datasource="#YourDSN#" name="GetRecords">
SELECT Name, Age FROM mytable
</cfquery>
<cfheader name="content-disposition" value="inline;filename=Results.xls">
<cfcontent type="application/msexcel">
<table border="1">
      <tr>
            <th>Name</th>
            <th>Age</th>
      </tr>
      <cfoutput query="GetRecords">
            <tr>
                  <td>#Name#</td>
                  <td>#Age#</td>
            </tr>
      </cfoutput>
</table>
-----------------------------------

That is the entire page.

Also note you should not used reserved words like "Name" as any column names.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now