Skip to content

Instantly share code, notes, and snippets.

@neokoenig
Last active January 26, 2017 21:29
Show Gist options
  • Save neokoenig/e812d357d2fc85824548eb801b979537 to your computer and use it in GitHub Desktop.
Save neokoenig/e812d357d2fc85824548eb801b979537 to your computer and use it in GitHub Desktop.
Lazy XLS generation
<cfheader name="Content-Disposition" value="inline; filename=#dateFormat(now(), 'yyyymmdd')#_report.xls">
<cfcontent type="application/vnd.ms-excel">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<body>
<cfoutput>
<table class="table table-condensed">
<thead>
<tr>
<cfloop list="#data.columnlist#" index="i">
<th>#i#</th>
</cfloop>
</tr>
</thead>
<tbody>
<cfloop query="data">
<tr>
<cfloop list="#data.columnlist#" index="z">
<td>#data["#z#"][currentrow]#</td>
</cfloop>
</tr>
</cfloop>
</tbody>
</table>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment