when we putWeb the data on the page leads toExcel form, sometimes our data needs to be presented in a specific format, and we need to giveCell Add some style specification information.
first, let's look at how Excel derives from Web pages. When we send this data to the client, we want to have the client program (the browser) read it in Excel format, so we set the MIME type to:application/vnd.ms-excel, when when Excel reads a file , it renders the data in the format of each cell , and if the cell does not have a specified format, Excel renders the cell in its default format the data. This gives us the space to customize the data format, and of course we must use the format supported by Excel. Here's a list of some commonly used formats:
1) text:vnd.ms-excel.numberformat:@
2) Date:vnd.ms-excel.numberformat:yyyy/mm/dd
3) number:vnd.ms-excel.numberformat: #,# #0. xx
4) Currency:vnd.ms-excel.numberformat:¥#,# #0. XX
5) percent:vnd.ms-excel.numberformat: #0.00%
These formats you can also customize, such as the year you can be defined as:yy-mm and so on. So what do you know about these formats and how do you add them to the cell ? Very simply, we just need to add the style to the corresponding label pair (that is, the closing tag). For example , add a style to the label pair , as follows:
< TD style =" vnd.ms-excel.numberformat:@ " > 410522198402161833 td>
Also, we can add styles or give them ,
add a style that will introduce a problem, do you notice? Let's look at the following code:
< Table style = ' vnd.ms-excel.numberformat:#,# #0. xx ' >
<tr>
<td>542 td>
<TD style= ' Vnd.ms-excel.numberformat: #0.00% ' > 0.25 td>
tr>
Table >
The above describes the Excel document in the digital format of the problem, including the content of Excel, I hope that the PHP tutorial interested in a friend to help.