CFCONTENT outputing to Excel issue
Hi folks,
I have a simple process that does a query and uses CFCONTENT to output a CFTABLE to a content type of "application/msexcel". Now this works fine 90% of the time. But I can reproduce a problem where it doesn't quite work as expected, when querying certain records. When this works, the user gets the file downloaded to them and they open it and they see their data. But with certain query results, the excel file opens and appears to be blank, but if you scroll down to like line 2000 you will see the embeddded HTML output for the CFTABLE with all the data. Like this:
<table border><tr><th>ID</th>.....
That's in the Excel file in place of just the outputed data.
Because I can reproduce it with the same query over and over, I know it's likely something in the data like an extra quote or something like that, which is throwing off CFCONTENT. Now, I can't control the data so I'm looking for suggestions for how I can wrap the data inside a CF Tag to preserve the output.
Any ideas? I don't have access to CF9/10 or I would explore CFSPREADSHEET. I have CF8. Thanks
My code is quite simple, basically like this:
| <cfcontent type="application/msexcel"> | ||
| <cfheader name="Content-Disposition" value="filename=Export.xls"> |
| <cfquery datasource="#DS#" name="Getdata"> | |
| select * from tablewhere practiceid = #practiceID# | |
| order byName | |
| </cfquery> | |
| <cftable query="getdata" htmltable="yes" colheaders="Yes" border="yes"> | ||
| <cfcol header="ID" text="#ID#"> | ||
| <cfcol header="First Name" text="#firstname#"> |
