this phpspreadsheet is really good but really documentationless. So, I read a lot and was trying to define my personal valueBinder, and I think that is correct but is not executed i suppose.
First thing first i create my binder like this :
class MyValueBinder extends DefaultValueBinder{
/**
* Bind value to a cell.
*
* @param Cell $cell Cell to bind value to
* @param mixed $value Value to bind in cell
*
* @return bool
*/
public function bindValue(Cell $cell, $value){
if($cell->getColumn() == 'D'){
// Set value explicit
//$cell->setValueExplicit($value, DataType::TYPE_STRING);
$cell->setValueExplicit("ok", DataType::TYPE_STRING);
}
return parent::bindValue($cell, $value);
}
}
Like you can see i was simply binding the type string for every cell in D column, then I tried to put the value ok in every cell in D column just for debug.
Then in my main page:
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Cell\Cell;
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder(new \PhpOffice\PhpSpreadsheet\Cell\MyValueBinder());
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
//After this I load my file e do some modifications and then I make
// a Writer CSV and write everything on a csv file.
At this point came the sadness because in the csv file i find the same wrong value, just for example if I have a number like 1345 in the csv I have 1,345
I don't want to rescan the CSV to correct this thing also because i have tens of thousands of rows