You are here

public function PHPExcel_Reader_Excel5::canRead in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::canRead()

* Can the current PHPExcel_Reader_IReader read the file? * *

Parameters

string $pFilename: * @return boolean * @throws PHPExcel_Reader_Exception

Overrides PHPExcel_Reader_Abstract::canRead

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php, line 439

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

public function canRead($pFilename) {

  // Check if file exists
  if (!file_exists($pFilename)) {
    throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
  }
  try {

    // Use ParseXL for the hard work.
    $ole = new PHPExcel_Shared_OLERead();

    // get excel data
    $res = $ole
      ->read($pFilename);
    return true;
  } catch (PHPExcel_Exception $e) {
    return false;
  }
}