格式化数字在Excel中的文本 [英] formatting numbers as text in excel
问题描述
建设一个Excel US preadsheet是一个经典的ASP应用程序。现在的问题是,一列由Excel中被自动格式化为一个数字时,它应该是文本,所以它是消除该老板想留住前导零。我做了一些网络搜索,你应该能够$ P $撇号P-追加到字符串迫使Excel将其显示为文本:
Building an excel spreadsheet is a classic asp application. The problem now is that one of the columns is being automatically formatted by excel as a number when it should really be text and so it is removing leading zeros which the boss wants to keep. I have done some web search and you should be able to pre-append an apostrophe to the string forcing excel to display it as text:
If isNumeric(val) Then
response.write "'" & val
Else
response.write val
End If
大,但Excel是现在显示的列与一家领先的撇号!从我所做的主导撇号应该被隐藏并仅用于Excel作为格式阅读,我究竟做错了什么?
Great, but excel is now displaying those columns with a leading apostrophe! From the reading that I have done the leading apostrophe should be hidden and only used by excel as formatting, what am I doing wrong?
感谢。
推荐答案
我周围一个小戳后,发现这个工作:
After a little poking around I found this to work:
Response.Write "=""" & Trim(val) & """"
正确显示,并没有显示格式化字符,当然,除非你点击单元格,然后将内容显示在标题中。
Displayed correctly and the formatting characters were not displayed, unless of course you click on the cell then the contents is displayed in the header.
这篇关于格式化数字在Excel中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!