In the process of using phpExcel, various problems are inevitable. especially when importing an excel table, we cannot always obtain the expected excel data from editing. for example, the following is: obviously, I only want the text in this object, and it just needs it... Some will be affected... syntaxHighlighter. all (); in the process of using phpExcel, it is inevitable that you will encounter a variety of problems, especially when importing an excel table, we are always unable to get the expected excel data from editing, for example, the following is:
Obviously, I only want the text in this object, and it just needs it... Some cannot stand it.
In fact, this solution is very simple. The following is the entire code snippet.
[Php]
Require_once SITE_PATH. '/PHPExcle/Classes/PHPExcel. php ';
Require_once SITE_PATH. '/PHPExcle/Classes/PHPExcel/IOFactory. php ';
Require_once SITE_PATH. '/PHPExcle/Classes/PHPExcel/Reader/Excel5.php ';
$ ObjReader = PHPExcel_IOFactory: createReader ('excel5 ');
$ ObjPHPExcel = $ objReader-> load ($ fileurl );
$ Sheet = $ objPHPExcel-> getSheet (0 );
$ HighestRow = $ sheet-> getHighestRow ();
$ HighestColumn = $ sheet-> getHighestColumn ();
For ($ j = 2; $ j <= $ highestRow; $ j ++ ){
For ($ k = 'a'; $ k <= $ highestColumn; $ k ++ ){
$ Array [$ j] [$ k] = (string) $ objPHPExcel-> getActiveSheet ()-> getCell ("$ k $ j")-> getValue ();
}
}
?>
That is, add a (string) in front of $ objPHPExcel-> getActiveSheet ()-> getCell ("$ k $ j")-> getValue ();.
That's easy!
Author longxuu