从 PHP 导出到 Excel - 单元格格式

发布于 2024-12-19 15:01:51 字数 282 浏览 2 评论 0原文

我正在使用 PHP 和 Codeigniter to_excel 助手将数据从数据库导出到 Excel 文件。

一切工作正常,除了我有一个包含 1-12-1 等格式的数据的字段。当我在 Excel 中打开文件时,Excel 是自动将此数据格式化为日期字段,使其显示 01-Jan02-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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昇り龍 2024-12-26 15:01:51

在数据前面添加一个撇号,以便 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文