Solve two problems: 1. The text data such as ID card is automatically converted into scientific notation. 2. Chinese garbled characters: How excel exports data from a Web page. When we send the data to the client, we want the Client Program (browser) to read it in excel format, so we set the mime type to applicationvnd. ms-exce.
Solve two problems: 1. The text data such as ID card is automatically converted into scientific notation. 2. Chinese garbled characters: How excel exports data from a Web page. When we send the data to the client, we want the Client Program (browser) to read it in excel format, so we set the mime type to application/vnd. ms-exce.
Solve two problems:
1. Text data such as ID cards is automatically converted into scientific notation.
2.Chinese garbled charactersProblems
How excel exports data from a Web page. When we send the data to the client, we want the Client Program (browser) to read it in excel format, so we set the mime type to application/vnd. ms-excel: When an excel file is read, data is displayed in the format of each cell. If the cell does not have a specified format, excel displays the data of the cell in the default format. This provides us with a space for custom data formats. Of course, we must use the formats supported by excel. Common formats are listed below:
1) Text: vnd. ms-excel.numberformat :@
2) Date: vnd. ms-excel.numberformat: yyyy/mm/dd
3) number: vnd. ms-excel.numberformat: #,## 0.00
4) Currency: vnd. ms-excel.numberformat: ¥ #, #0.00
5) percentage: vnd. ms-excel.numberformat: # 0.00%
"
For exampleStyle:
Echo"". $ Printable ."\ N ";
$ Filename = iconv ("UTF-8", "GB2312 // IGNORE", "member name .xls"); // date ('Y-m-d-H-I-S '). ". xls "; header (" Content-type: application/vnd. ms-excel "); Header (" Accept-Ranges: bytes "); Header (" Content-Disposition: attachment; filename = ". $ filename); // $ filename the exported file name header ("Pragma: no-cache"); header ("Expires: 0"); echo'
'; Echo"
". Iconv (" UTF-8 "," GB2312 // IGNORE "," member name ")." |
". Iconv (" UTF-8 "," GB2312 // IGNORE "," account ")." |
". Iconv (" UTF-8 "," GB2312 // IGNORE "," Contact ")." |
"; Foreach ($ list as $ v) {echo"
"; Echo"
". Iconv (" UTF-8 "," GB2312 // IGNORE ", $ v [" user_name "])." | "; Echo"
". $ V [" account_id "]." | "; Echo"
". Iconv (" UTF-8 "," GB2312 // IGNORE ", $ v [" contact_name "])." | "; Echo"
";} Echo"
";