格式化HTML表格单元格,使Excel格式为文本? [英] Format HTML table cell so that Excel formats as text?

查看:367
本文介绍了格式化HTML表格单元格,使Excel格式为文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个HTML表格,将在Excel中作为电子表格打开。什么HTML标签或CSS样式,我可以用来告诉Excel显示单元格的内容为文本?

I am creating an HTML table that will be opened as a spreadsheet in Excel. What HTML tag or CSS style can I use to "tell" Excel to display the cell's contents as text?

推荐答案

您可以申请格式化数字,文本,日期等细胞。

请参阅我以前的答案:

You can apply formatting to the cells for numbers, text, dates, etc.

(调整过的片段)



If you add a CSS Class to your page:

.num {
  mso-number-format:General;
}
.text{
  mso-number-format:"\@";/*force text*/
}

然后在你的TD上打这些类,是否有效?

And slap those classes on your TD's, does it work?

<td class="num">34</td>
<td class="num">17.0</td>
<td class="text">067</td>

这篇关于格式化HTML表格单元格,使Excel格式为文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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