格式< cfspreadsheet>作为表 [英] Format <cfspreadsheet> as table

查看:209
本文介绍了格式< cfspreadsheet>作为表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用< cfspreadsheet> 将数据库查询输出到Excel电子表格。当手动创建这些电子表格时,可以突出显示所有单元格和格式为表格。这意味着当点击表格标题时,用户可以对表格进行升序和降序排序。

I'm using <cfspreadsheet> to output a database query to an Excel spreadsheet. When these spreadsheets are created manually it is possible to highlight all the cells and 'Format as table'. This means when the table header is clicked, the user can sort the table ascending and descending.

可以在ColdFusion中指定此格式生成Excel文件时的代码

Is it possible to specify this formatting in the ColdFusion code when generating the Excel file?

推荐答案

如果您使用Coldfusion 9, SpreadSheetNew,然后是SpreadSheetAddRow,SpreadSheetFormat函数对数据集中的Excel电子表格进行样式化。

If you are on Coldfusion 9, you can use SpreadSheetNew, then SpreadSheetAddRow, SpreadSheetFormat functions to style an excel spreadsheet from a data set

 <cfset sObj = spreadsheetNew("myreport","yes")>
 <cfset SpreadsheetAddRow(sObj, "Column_1, ... , Column27")>

 <cfset SpreadsheetFormatRow(sObj, {bold=TRUE, alignment="center"}, 1)>

 <cfset spreadsheetAddRows(sObj, qMyQuery)>
    <cfheader name="content-disposition" value="attachment; filename=report_#Dateformat(NOW(),"MMDDYYYY")#.xlsx">

BE警告,但是,这可能是非常征税的JVM,我有一个查询, xls与,只应用两个样式(粗体,文本中心)到标题行,任何查询超过700行将关闭整个服务器通过JVM内存损失...这里是我的问题,关于它,与相关代码/ answer SpreadsheetAddRows在适中大小的查询中失败

BE WARNED however, this can be extremely taxing to the JVM, I had a query i was creating an xls with, applying only two styles (bold, text-center) to the header row, and any query over 700 rows would shut down the entire server via JVM memory loss...here is my SO question about it, with related code/answer SpreadsheetAddRows failing on moderate size query

它已被记录为adobe是一个错误

It has been documented with adobe as being a bug

这篇关于格式&lt; cfspreadsheet&gt;作为表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆