Esempio n. 1
0
 /**
  * Check a string that it satisfies Excel requirements
  *
  * @param  mixed  Value to sanitize to an Excel string
  * @return mixed  Sanitized value
  */
 public static function checkString($pValue = null)
 {
     if ($pValue instanceof \PHPExcel\RichText) {
         // TODO: Sanitize Rich-Text string (max. character count is 32,767)
         return $pValue;
     }
     // string must never be longer than 32,767 characters, truncate if necessary
     $pValue = \PHPExcel\Shared\StringHelper::substring($pValue, 0, 32767);
     // we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
     $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
     return $pValue;
 }