PHPexcel export garbled problem solution

Source: Internet
Author: User
PHPexcel: How to export garbled data in PHP 2003 and other versions? but how to export garbled data in excel2007:

String format for excel to export. Valid value are 'excel5', 'excel2007 ', 'excel2003xml', '00calc', 'gnumeric '.

Find the createWrite method and change the second parameter to the EXCEL version to be generated:

For example:

$ ObjWriter = PHPExcel_IOFactory: createWriter ($ objPHPExcel, 'excel5'); $ objWriter-> save ('php: // output ');

Of course, if the framework is used, such as the YII2 framework, it is recommended to encapsulate it into a small object. recommended:

Https://github.com/moonlandsoft/yii2-phpexcel

Usage of small objects:

Use moonland \ phpexcel \ Excel; public function actionT () {$ result = Test: find ()-> all (); Excel :: widget (['models' => $ result, 'mode' => 'port', 'format' => 'excel5', 'columns '=> ['itemid ', 'username', 'Company'], 'headers' => ['itemid' => 'Id ', 'username' => 'username ', 'Company' => 'Company'],]);}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.