PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

xls to csv problem new-lines #1271

Closed dnsBlah closed 7 years ago

dnsBlah commented 7 years ago

Hi all,

I was hoping to get this working with linebreaks within a cell, however the newlines become a new record..

Any advice?

    $fileType = PHPExcel_IOFactory::identify($infile);
    $objReader = PHPExcel_IOFactory::createReader($fileType);

    $objReader->setReadDataOnly(true);   
    $objPHPExcel = $objReader->load($infile);    

    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
    $objWriter->setEnclosure('"');
    $objWriter->setUseBOM( true ); //true or false not making a difference.

    $objWriter->save($outfile);
dnsBlah commented 7 years ago

Nevermind I solved it using a 'unique' delimter and lineEnding and just process it from there.

However it would be nice to have better support for linebreaks in within excel cells.