Using PHPExcel_Cell_AdvancedValueBinder

Topics: Developer Forum, Project Management Forum
Jun 12, 2014 at 5:17 PM

I need to create sheets that have excel types, like date, number etc. Without the Advanced Binder, all of the data goes to excel in "general" format. So I tried to use the following example from the documentation of PHPExcel:
require_once 'PHPExcel.php'; 
require_once 'PHPExcel/Cell/AdvancedValueBinder.php'; 
require_once 'PHPExcel/IOFactory.php';

// Set value binder 
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );

$objPHPExcel = new PHPExcel(); 

// ..
And in my code i've been using
$sheet->setCellValueByColumnAndRow($columnActive, $rowActive, $valor);
That worked, but only on a few lines from the file that is generated. For example, in a sheet with 2 columns, the first column gets formated until row 48 and the second column gets formated until row 33. Looks like PHPExcel converts the text, but doesnt get it formated. On date fields, until line 48 the date is formated, but after is just numbers (that I believe are the dates without a mask).

I don't know if there's another way to convert the values, if there is, I would appreciate the help.