gpt4 book ai didi

excel - ColdFusion (9) 在导出到 Microsoft Excel 时神秘地删除数字后的字符 'D' 和 'F' (2007)

转载 作者:行者123 更新时间:2023-12-02 07:55:21 26 4
gpt4 key购买 nike

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

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");

<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)#"/>

问题在于“4D”和“4F”(而不是其他)丢失了“D”和“F”并被格式化为数字。

我尝试过这个:

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

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

这很奇怪;有人知道发生了什么吗?

最佳答案

解决方法似乎是将单元格公式设置为文字“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");

我仍然不知道为什么会发生这种情况,但我的想法是 SpreadsheetAddRow() 和 SpreadsheetSetCell() 将 4D 和 4F 解释为数字,并将 D 和 F 以及后缀解释为常量对于 Double 和 Float,并在转换后将它们剥离。

您可以通过访问 https://bugbase.adobe.com/index.cfm 将错误提交给 Adob​​e .

关于excel - ColdFusion (9) 在导出到 Microsoft Excel 时神秘地删除数字后的字符 'D' 和 'F' (2007),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5346396/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com