Example #1
0
 /**
  * Gets a sheet by a loose name match unless
  * exactMatch is true. Returns a PHPExcel_Worksheet object
  * if a match is found, false if no match.
  * @param $name
  * @param bool|false $exactMatch
  * @return bool|\PHPExcel_Worksheet
  */
 private function getSheetByName($name, $exactMatch = false)
 {
     if ($exactMatch === false) {
         $name = strtolower($name);
         // determine a case insensitive match
         foreach ($this->workbook->getSheetNames() as $sheet) {
             if (strtolower($sheet) === $name) {
                 $use = $sheet;
                 break;
             }
         }
         if (!isset($use)) {
             return false;
         }
         $this->worksheet = $this->workbook->getSheetByName($use);
     } else {
         if ($this->workbook->sheetNameExists($name)) {
             $this->worksheet = $this->workbook->getSheetByName($name);
         } else {
             return false;
         }
     }
     return $this->worksheet;
 }