PHP Classes

Fatal error: Call to a member function dimension() on null

Recommend this page to a friend!

      SimpleXLSX  >  All threads  >  Fatal error: Call to a member...  >  (Un) Subscribe thread alerts  
Subject:Fatal error: Call to a member...
Summary:How to fix?
Messages:2
Author:????????? ??????
Date:2018-04-06 15:31:03
 

  1. Fatal error: Call to a member...   Reply   Report abuse  
Picture of ????????? ?????? ????????? ?????? - 2018-04-06 15:31:03
Hi, error in example 8 - parse data

$data = file_get_contents('http://www.example.com/example.xlsx');
if ( $xslx = SimpleXLSX::parse( $data, true) ) {
list($num_cols, $num_rows) = $xlsx->dimension(2);
echo $xlsx->sheetName(2).':'.$num_cols.'x'.$num_rows;
} else {
echo SimpleXLSX::parse_error();
}

  2. Re: Fatal error: Call to a member...   Reply   Report abuse  
Picture of Sergey Shuchkin Sergey Shuchkin - 2018-04-06 16:23:13 - In reply to message 1 from ????????? ??????
don't call $xlsx->dimension(2)

some xlsx has empty xml data about dimension

use $xlsx->rows();

$rows = $xlsx->rows();

$lines = count( $rows );
$columns = count( $rows[0] );