“Excel found unreadable content” warning when opening Excel files made with PHPExcel

前端 未结 6 627
情深已故
情深已故 2020-12-31 02:44

I\'m trying to download Excel files (xlsx) using PHPExcel as follows.

require_once(\"../../phpExcel/Classes/PHPExcel.php\");
require_once(\"../../phpExcel/Cl         


        
6条回答
  •  臣服心动
    2020-12-31 03:14

    Well I had this problem, my solution was changing the header Content-type to :

    header('Content-Type: application/openxmlformats-officedocument.spreadsheetml.sheet');
    

    I had before:

    header('Content-Type: application/vnd.ms-excel'); 
    

    and I changed the format to Excel2007, I was using Excel5 for excel 2003 xls format.

    I tried all the solutions from this page and all the other pages with the same question but not luck. So basically, I just changed the output format of my excels and that solved the problem.

提交回复
热议问题