ColdFusion(9)导出到Microsoft Excel(2007)神秘地删除字符'D'和数字后的数字, [英] ColdFusion (9) mysteriously removes characters 'D' and 'F' after numbers when exporting to Microsoft Excel (2007)

查看:149
本文介绍了ColdFusion(9)导出到Microsoft Excel(2007)神秘地删除字符'D'和数字后的数字,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是一些代码片段的示例:

  theSheet = SpreadsheetNew(Rates,True); 
SpreadsheetAddRow(Theheet,4A,4B,4C,4D,4E,4F,4G,4H,4I,4J);
SpreadsheetAddRow(Theheet,4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T)
SpreadsheetAddRow(Theheet,4U,4V,4W,4X,4Y,4Z,4D4,4F4);

 < cfheader name =content-dispositionvalue =attachment; filename =#GetTickCount()#。xlsx> 
< CFHEADER NAME =ExpiresVALUE =#now()#>
< cfcontent type =application / vnd.openxmlformats-officedocument.spreadsheetml.sheetvariable =#SpreadsheetReadBinary(theSheet)#/>问题是4D和4F(而不是其他)丢失D



我尝试过:

 

code> formatText = StructNew();
formatText.dataformat =@;
SpreadsheetFormatColumns(theSheet,formatText,1-10);

我确认这将Excel中的格式设置为文本,但现在我只是看到4在文本格式的单元格!我也尝试使用'字符,但是当它在Excel中打开时,它只是显示'而不是字母表的单元格。



这是很奇怪;

解决方案

似乎一个解决方法是将单元格公式设置为文字4D 。

  theSheet = SpreadsheetNew(Rates,True); 
SpreadsheetAddRow(Theheet,4A,4B,4C ,, 4E ,, 4G,4H,4I,4J);
SpreadsheetSetCellFormula(TheSheet,4D,1,4);
SpreadsheetSetCellFormula(TheSheet,4F,1,6);
SpreadsheetAddRow(Theheet,4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T);
SpreadsheetAddRow(Theheet,4U,4V,4W,4X,4Y,4Z,4D4,4F4);

我仍然不知道为什么会发生这种情况,是SpreadsheetAddRow()和SpreadsheetSetCell()将4D和4F解释为数字,并解释D和F和后缀代表Double和Float,并在转换后剥离它们。



您可以前往 https://bugbase.adobe.com/index.cfm ,将错误提交给Adobe 。


Here's some code snippets for an example:

theSheet = SpreadsheetNew("Rates","True");
SpreadsheetAddRow(theSheet,"4A,4B,4C,4D,4E,4F,4G,4H,4I,4J");
SpreadsheetAddRow(theSheet,"4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T");
SpreadsheetAddRow(theSheet,"4U,4V,4W,4X,4Y,4Z,4D4,4F4");

and

<cfheader name="content-disposition" value="attachment; filename=#GetTickCount()#.xlsx">
<CFHEADER NAME="Expires" VALUE="#now()#">
<cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" variable="#SpreadsheetReadBinary(theSheet)#"/>

The issue is that "4D" and "4F" (and not the others) lose the 'D' and 'F' and are formatted as a number.

I tried this:

formatText = StructNew();
formatText.dataformat="@";
SpreadsheetFormatColumns(theSheet,formatText,"1-10");

I verified that this set the format in Excel to "Text", but now I just see the number 4 in a Text-formatted cell! I also tried using the ' character, but when it opens in Excel, it just shows the ' instead of literalizing the cell.

This is rather strange; anybody have an idea about what's going?

解决方案

It seems that a workaround is to set the cell formula to be the literal "4D".

theSheet = SpreadsheetNew("Rates","True");
SpreadsheetAddRow(theSheet,"4A,4B,4C,,4E,,4G,4H,4I,4J");
SpreadsheetSetCellFormula(theSheet, """4D""", 1, 4);
SpreadsheetSetCellFormula(theSheet, """4F""", 1, 6);
SpreadsheetAddRow(theSheet,"4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T");
SpreadsheetAddRow(theSheet,"4U,4V,4W,4X,4Y,4Z,4D4,4F4");

I still don't know why this is happening, but my idea is that SpreadsheetAddRow() and SpreadsheetSetCell() are interpreting 4D and 4F as numeric and are interpreting the D and F and suffixes standing for Double and Float, and stripping them out after conversion.

You can submit the bug to Adobe by going to https://bugbase.adobe.com/index.cfm.

这篇关于ColdFusion(9)导出到Microsoft Excel(2007)神秘地删除字符'D'和数字后的数字,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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