CFSpreadSheet - 格式列不格式化整个列 [英] CFSpreadSheet - format column not formatting the entire column

查看:213
本文介绍了CFSpreadSheet - 格式列不格式化整个列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CF10标准从查询中创建电子表格。无论我到目前为止已经尝试过,特定列的格式化在第32行(1个标题行,31个数据)停止,即使整个工作表填充到186行。

Using CF10 Standard to create a spreadsheet from a query. No matter what I've tried so far, the formatting for a specific column stops at row 32 (1 header row, 31 data), even though the entire sheet is populated to 186 rows.

<cfscript>
 dfStyle=StructNew();
 dfStyle.fgcolor="pale_blue";
 dfStyle.dataformat="mm/dd/yyyy";
 theSheet = SpreadSheetNew('mysheet');
 SpreadSheetAddRow(theSheet,'SID,FIRST,LAST,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,EMAIL,ADDED,PID');
 SpreadSheetAddRows(theSheet,qry);
 SpreadSheetFormatColumn(theSheet,dfStyle,10);
</cfscript>

我想在ADDED列上获得一致的mm / dd / yyyy格式。

I'm trying to get a consistent mm/dd/yyyy format on the 'ADDED' column. Instead, I'm getting that through row 31, and then getting dates like 41937.56594 on the of the rows.

在公式栏中显示10/20/2014 12:25:23 PM作为第一个值,41932.552037037作为第二个值。

In the formula bar I show "10/20/2014 12:25:23 PM" as the first value and "41932.552037037" as the 2nd value.

如果我在查询中格式化日期(即date_format(sp_add,'%c /%e /%Y')AS spadd)我得到一个很好的日期格式一直向下的列,但蓝色仍然停止在第32行。

If I format the date in the query (i.e. date_format(sp_add,'%c/%e/%Y') AS spadd) I do get a nice date format all the way down the column, but the blue still stops at row 32.

这里是cfoutput的匿名查询 - 顶行格式化,底行丢失格式化(背景颜色 - 格式化查询中的日期)。我也从现在的查询中删除了ADDRESS2列。

Here is the cfoutput of the anonymized query - top row is formatted, bottom row loses formatting (background color - formatting dates in query). I also dropped the ADDRESS2 column from the query for now.

推荐答案

我不知道问题是什么,但尝试使用XML格式选项生成xlsx文件而不是旧样式xls文件的选项)。在您的代码中,为您的spreadsheetnew()函数调用添加true作为第二个参数。

I'm not sure what the problem is, but try using the XML format option (the option to produce an xlsx file instead of the older style xls file). In your code add the "true" as a second argument to your spreadsheetnew() function call.

<cfscript>
 dfStyle=StructNew();
 dfStyle.fgcolor="pale_blue";
 dfStyle.dataformat="mm/dd/yyyy";

 theSheet = SpreadSheetNew('mysheet',TRUE);

 SpreadSheetAddRow(theSheet,'SID,FIRST,LAST,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,EMAIL,ADDED,PID');
 SpreadSheetAddRows(theSheet,qry);
 SpreadSheetFormatColumn(theSheet,dfStyle,10);
</cfscript>

这将解决问题 - 虽然我们不知道为什么:)

This will solve the problem - though we don't know why :)

这篇关于CFSpreadSheet - 格式列不格式化整个列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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