You are here

public static function PHPExcel_Cell_DataType::checkString in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataType.php \PHPExcel_Cell_DataType::checkString()

Check a string that it satisfies Excel requirements

Parameters

mixed Value to sanitize to an Excel string:

Return value

mixed Sanitized value

1 call to PHPExcel_Cell_DataType::checkString()
PHPExcel_Cell::setValueExplicit in vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell.php
* Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder) * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataType.php, line 89

Class

PHPExcel_Cell_DataType
PHPExcel_Cell_DataType

Code

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_String::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;
}