Home >Backend Development >PHP Tutorial >Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007

Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007

WBOY
WBOYOriginal
2016-07-29 08:52:591015browse

当我们把web页面上的数据导成excel形式时,有时候我们的数据需要以特定的格式呈现出来,这时候我们就需要给cell添加一些样式规格信息。

       首先,我们了解一下excelweb页面上导出的原理。当我们把这些数据发送到客户端时,我们想让客户端程序(浏览器)以excel的格式读取它,所以把mime类型设为:application/vnd.ms-excel,当excel读取文件时会以每个cell的格式呈现数据,如果cell没有规定的格式,则excel会以默认的格式去呈现该cell的数据。这样就给我们提供了自定义数据格式的空间,当然我们必须使用excel支持的格式。下面就列出常用的一些格式:

1) 文本:vnd.ms-excel.numberformat:@

2) 日期:vnd.ms-excel.numberformat:yyyy/mm/dd

3) 数字:vnd.ms-excel.numberformat:#,##0.00

4) 货币:vnd.ms-excel.numberformat:¥#,##0.00

5) 百分比:vnd.ms-excel.numberformat: #0.00%

这些格式你也可以自定义,比如年月你可以定义为:yy-mm等等。那么知道了这些格式,怎么去把这些格式添加到cell中呢?很简单,我们只需要把样式添加到对应的标签对(即闭合标签)即可。如

,给标签对 添加样式,如下:

Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007td style="vnd.ms-excel.numberformat:@">410522198402161833td>


同样,我们也可以给

Add styles, you can also add styles to ,
, this will introduce a problem, have you noticed? ? First look at the following code:

Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007table style='vnd.ms-excel.numberformat:#,##0.00'>
Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007
tr>
                                        ​t;Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007
​​​​​​​td​​​​​ style='vnd.ms-excel.numberformat: #0.00%'>0.25
Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007
td> tr >table>
Issues about number format in importing excel documents. How to make excel drop-down menu. excel2013 official download excel2007
The above introduces the issues related to digital format in importing excel documents, including excel content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn