PHP_XLSXWriter
PHP_XLSXWriter copied to clipboard
New lines only appear after Save & Open
I'm trying to get new lines inside a header cell. Only after I open the document, save it, and reopen it, the contents are as expected.
Code:
$writer = new XLSXWriter();
$writer->writeSheetHeader('Sheet1', array("1\n22222222"=>'string'),
$col_options = array('height'=>30,'wrap_text'=>true));
$writer->writeSheetRow('Sheet1', array("a\nbbbbbbbb"),
$row_options = array('height'=>30,'wrap_text'=>true) );
Opened before a save:
And after a save & reopen:
These are the Excels:
Excel Mac Office 2017
Don't macs use \r as their newline character? Have you tried using \r\n CRLF instead of \n so its more compatible?
I've unpacked the xlsx file, ran unix2dos on the contents, and zipped it back. Same result, so \n or \r\n does not make a difference.
The text "abc\r\ndef", on the mac, I have the same problem, the same file can be wrapped under the window