You are here

public function PHPExcel_Cell_DefaultValueBinder::bindValue in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DefaultValueBinder.php \PHPExcel_Cell_DefaultValueBinder::bindValue()

Bind value to a cell

Parameters

PHPExcel_Cell $cell Cell to bind value to:

mixed $value Value to bind in cell:

Return value

boolean

Overrides PHPExcel_Cell_IValueBinder::bindValue

1 call to PHPExcel_Cell_DefaultValueBinder::bindValue()
PHPExcel_Cell_AdvancedValueBinder::bindValue in vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/AdvancedValueBinder.php
Bind value to a cell
1 method overrides PHPExcel_Cell_DefaultValueBinder::bindValue()
PHPExcel_Cell_AdvancedValueBinder::bindValue in vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/AdvancedValueBinder.php
Bind value to a cell

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DefaultValueBinder.php, line 55

Class

PHPExcel_Cell_DefaultValueBinder
PHPExcel_Cell_DefaultValueBinder

Code

public function bindValue(PHPExcel_Cell $cell, $value = null) {

  // sanitize UTF-8 strings
  if (is_string($value)) {
    $value = PHPExcel_Shared_String::SanitizeUTF8($value);
  }
  elseif (is_object($value)) {

    // Handle any objects that might be injected
    if ($value instanceof DateTime) {
      $value = $value
        ->format('Y-m-d H:i:s');
    }
    elseif (!$value instanceof PHPExcel_RichText) {
      $value = (string) $value;
    }
  }

  // Set value explicit
  $cell
    ->setValueExplicit($value, self::dataTypeForValue($value));

  // Done!
  return true;
}