I export some of my db into a csv using PhpExcel.
Because I have quite some corrupted data, I check them and display the errors when necessary.
So I would like to display in my error message when a field contains my separator (otherwise it would mess with my pagination) :
$objWriter = PHPExcel_IOFactory::createWriter($this->_objErrorPHPExcel, 'CSV');
$objWriter->setDelimiter('|');
$objWriter->setEnclosure( '' );
$objWriter->setUseBOM( true );
$objWriter->setPreCalculateFormulas( false );
$objWriter->save( $strOutputFile );
unset( $objWriter );
When I save my error message (for an email address like em|ail@email.com) :
$this->$strExcelFileName->getActiveSheet()->setCellValueExplicit('F' . $intRow, $strError );
Instead of saving in my F cell
EMail contains “|” character
I end up
EMail contains
in F, and
|
character in G.
I then have the same problem when I save the email in the spreadsheet, it is cut in 2 cells.
Thanks for your time and advices 🙂
The solution was provided by DaveRandom ! :