Using PHPExcel to export to xlsx

前端 未结 1 561
故里飘歌
故里飘歌 2020-12-29 10:41

I am using PHPEXxcel to export an HTML Table generated using MYSQL and its like this.



        
相关标签:
1条回答
  • 2020-12-29 11:08

    Spreadsheets 101

    There are many different spreadsheet file formats, each with their own different filename extensions, and that can be sent to a web browser using different mime types. These are described in the PHPExcel documentation, and each has its own different Writer in PHPExcel. You're mismatching two different formats

    BIFF Format

    • Used by Microsoft Excel between versions 95 and 2003 File

    • extension: xls

    • PHPEXcel Writer: PHPExcel_Writer_Excel5

    • Mime Type: application/vnd.ms-excel

    OfficeOpenXML Format

    • Used by Microsoft Excel since version 2007

    • File extension: xlsx

    • PHPEXcel Writer: PHPExcel_Writer_Excel2007

    • Mime Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

    Don't mix and match: if you do, then Excel will (and justifiably) complain. If you want a BIFF file, use PHPExcel's BIFF Writer (Excel5), a file extension of .xls, and the mime type listed above for BIFF Format. If you want an OfficeOpenXML file, then use PHPExcel's Excel2007 Writer, a file extension of .xlsx, and the mime type listed above for OfficeOpenXML.

    EDIT

    Note that the examples provided with the PHPExcel distribution include 01simple-download-xls.php and 01simple-download-xlsx.php to demonstrate exactly what you want

    0 讨论(0)
提交回复
热议问题