本文介绍了cfspreadsheet以d结尾的字母数字值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<cfscript>
Workbook = Spreadsheetnew("Workbook");
SpreadSheetSetCellValue(WorkBook, "4D", 1, 1);
// displayed 4
SpreadSheetSetCellValue(WorkBook, "4C", 1, 2);
// displayed 4C
SpreadSheetSetCellValue(WorkBook, "4E", 1, 3);
// displayed 4E
SpreadSheetSetCellValue(WorkBook, "5C", 1, 4);
// displayed 5C
SpreadSheetSetCellValue(WorkBook, "5D", 1, 5);
// displayed 5
SpreadSheetSetCellValue(WorkBook, "4d", 1, 6);
// displayed 4
MYfile = "d:\dw\dwtest\dan\abc.xls";

</cfscript>
<cfspreadsheet action="write" filename="#MYFile#" name="Workbook"
    sheet=1 overwrite=true>

ColdFusion设置:
版本9,0,1, 274733

Edition企业

操作系统Windows 2003

操作系统版本5.2

ColdFusion Setttings:Version 9,0,1,274733
Edition Enterprise
Operating System Windows 2003
OS Version 5.2

Excel版本
Office 2010
版本14.0.6129.5000(32位)。

Excel VersionOffice 2010Version 14.0.6129.5000 (32 bit).

如果您在系统上运行此代码,获得相同的结果?

If you run this code on your system, do you get the same results?

更重要的是,如果你得到相同的结果,你知道该怎么办吗?

More importantly, if you get the same results, do you know what to do about it?

编辑

检查其他有问题的字母:

Checking for other problematic letters:

RowNumber = 1;
for (i = 65; i <= 90; i++){
SpreadSheetSetCellValue(WorkBook, chr(i), RowNumber, 1);
SpreadSheetSetCellValue(WorkBook, "4#chr(i)#", RowNumber, 2);
RowNumber ++;
}

字符串4F也只显示数字。

The string 4F also displayed the number only.

推荐答案

这里的问题是POI将F和D解释为Java具有的单/双精度后缀。请参阅文档。

The issue here is that POI is interpreting the F and D as the single/double precision suffixes that Java has. See docs here.

我会说这是CF的一个错误,因为CFML没有这些后缀的概念(或者实际上是单精度浮点或双精度浮点的概念),所以它应该确保这样的字符串被处理为

I would say this is a bug with CF, as CFML does not have the concept of these suffixes (or indeed the notion of single or double precision floats), so it should make sure such strings get treated as strings when being passed to POI.

这篇关于cfspreadsheet以d结尾的字母数字值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 07:51