从 PHP 导出到 Excel - 单元格格式
我正在使用 PHP 和 Codeigniter to_excel 助手将数据从数据库导出到 Excel 文件。
一切工作正常,除了我有一个包含 1-1、2-1 等格式的数据的字段。当我在 Excel 中打开文件时,Excel 是自动将此数据格式化为日期字段,使其显示 01-Jan、02-Jan 等。
有没有办法强制 Excel 不将此数据格式化为日期场地?
谢谢。
I am exporting data from a database to an Excel file using PHP and a Codeigniter to_excel helper.
Everything is working correctly, except I have a field that contains data in the format of 1-1, 2-1 etc. When I open the file in Excel, Excel is automatically formatting this data as a date field so that it appears 01-Jan, 02-Jan etc.
Is there a way to force Excel not to format this data as a date field?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在数据前面添加一个撇号,以便 Excel 将其视为文本。这需要在 Excel 中打开之前完成。
Preface the data with a single apostrophe so that Excel treats it as text. This needs to be done before it is opened in Excel.