本文介紹了格式化 HTML 表格單元格以便 Excel 格式化為文本?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
限時(shí)送ChatGPT賬號(hào)..
我正在創(chuàng)建一個(gè) HTML 表格,該表格將在 Excel 中作為電子表格打開(kāi).我可以使用什么 HTML 標(biāo)記或 CSS 樣式來(lái)告訴"Excel 將單元格的內(nèi)容顯示為文本?
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?
推薦答案
您可以對(duì)單元格應(yīng)用數(shù)字、文本、日期等格式
You can apply formatting to the cells for numbers, text, dates, etc.
請(qǐng)參閱我之前的回答:HTML 到 Excel:如何告訴 Excel 將列視為數(shù)字?
(調(diào)整后的片段)
如果您在頁(yè)面中添加 CSS 類:
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>
這篇關(guān)于格式化 HTML 表格單元格以便 Excel 格式化為文本?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!