本文介绍了防止Excel以科学记数法重新格式化文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本,可以将数据从数据库导出到不同的格式,包括作为Excel文档。如果一个文本字段包含一个像 123123123123 这样的值,Excel默认将它转换为 1.23123E + 11 。是否有可能防止这种绝对不必要的行为?如果你的目标是将数字存储为文本(而不是数学稍后),PHP以CSV格式导出,一个简单的解决方案是将数字导出为 CONCATENATE 函数。


$ b当在Excel中打开CSV时,以文本格式显示为 123123123123 ,$ b

= CONCATENATE(123123123123)

I have a PHP script which exports data from database to different formats, including as an Excel document. If a text field contains such a value as 123123123123, Excel, by default converts it to 1.23123E+11. Is it possible to prevent this absolutely unnecessary behaviour?

解决方案

If your goal is to store the number as text (and not do math on it later) and the PHP is exporting as a CSV, a simple solution would be to export the number as a CONCATENATE function.

=CONCATENATE(123123123123) renders as 123123123123 in text format when the CSV is opened in Excel (this is for Excel 2010).

这篇关于防止Excel以科学记数法重新格式化文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 22:45