如何确保我的Excel单元格被视为一个字符串? [英] How can I ensure that my Excel cell will be treated as a string?

查看:241
本文介绍了如何确保我的Excel单元格被视为一个字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Coldfusion创建一个基本的Excel电子表格。我创建一个表,然后使用以下代码将其转换为Excel:

 < cfset fileName =myFile.xls > 
< CFHEADER NAME =Content-DispositionVALUE =attachment; filename =#fileName#>
< cfcontent type =application / msexcelreset =true>
< cfoutput>#myExcel#< / cfoutput>

myExcel变量包含一个HTML表。


$ b $我的问题是,一些单元格包含值,如:281E47。哪个Excel然后翻译成2.81E + 49。如何在HTML表格中指定我想要将这些值以文字形式显示为文本,而不是转换为数字?

解决方案

另一个线程的答案对我有用:



导出到Excel不正确显示数字


I am using Coldfusion to create a basic Excel spreadsheet. I build a table, and then convert it to Excel using the following code:

<cfset fileName = "myFile.xls">
<CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=#fileName#">
<cfcontent type="application/msexcel" reset="true">
<cfoutput>#myExcel#</cfoutput>

The "myExcel" variable holds an HTML table.

My problem is that some of the cells contain values such as: 281E47. Which Excel is then translating to 2.81E+49. How can I specify, in my HTML table, that I want these values to be displayed literally, as text, rather than converted into a number?

解决方案

This answer to another thread worked for me:

Export to Excel not displaying numbers correctly

这篇关于如何确保我的Excel单元格被视为一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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