You are here

private static function PHPExcel_Worksheet::_checkSheetCodeName in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php \PHPExcel_Worksheet::_checkSheetCodeName()

Check sheet code name for valid Excel syntax

Parameters

string $pValue The string to check:

Return value

string The valid string

Throws

Exception

1 call to PHPExcel_Worksheet::_checkSheetCodeName()
PHPExcel_Worksheet::setCodeName in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
* Define the code name of the sheet * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php, line 435

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

private static function _checkSheetCodeName($pValue) {
  $CharCount = PHPExcel_Shared_String::CountCharacters($pValue);
  if ($CharCount == 0) {
    throw new PHPExcel_Exception('Sheet code name cannot be empty.');
  }

  // Some of the printable ASCII characters are invalid:  * : / \ ? [ ] and  first and last characters cannot be a "'"
  if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue || PHPExcel_Shared_String::Substring($pValue, -1, 1) == '\'' || PHPExcel_Shared_String::Substring($pValue, 0, 1) == '\'') {
    throw new PHPExcel_Exception('Invalid character found in sheet code name');
  }

  // Maximum 31 characters allowed for sheet title
  if ($CharCount > 31) {
    throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet code name.');
  }
  return $pValue;
}