Javascript 如何在Coldfusion中将DB表结果生成为Excel文件

Javascript 如何在Coldfusion中将DB表结果生成为Excel文件,javascript,excel,coldfusion-10,Javascript,Excel,Coldfusion 10,是否有coldfusion的库或脚本可以帮助生成数据库表数据的excel。希望,这会有所帮助 <cfoutput> <cfquery name="getUsers" datasource="stackoverflow"> select * from users </cfquery> <cfheader name="Content-Disposition" value="inline; filename=test.

是否有coldfusion的库或脚本可以帮助生成数据库表数据的excel。

希望,这会有所帮助

<cfoutput>
    <cfquery name="getUsers" datasource="stackoverflow">
        select * from users
    </cfquery>

    <cfheader name="Content-Disposition" value="inline; filename=test.xlsx">
    <cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"> 
    <table border="1">
        <tr>
            <th>firstName</th>
            <th>lastName</th>
            <th>city</th>
        </tr>
        <cfloop query="#getUsers#">
            <tr>
            <td>#firstName#</td>
            <td>#lastName#</td>
            <td>#city#</td>
            </tr>
        </cfloop>
    </table>
</cfoutput>

你看过cfspreadsheet标签了吗?欢迎来到Stack Overflow!请不要只回答源代码。试着提供一个关于你的解决方案如何工作的很好的描述。请参阅:。谢谢这不是Excel电子表格。它是HTML。不鼓励使用html技巧,因为它现在会在Excel中导致损坏的文件警告