wrapped format won't work #35

Closed
onlime opened this Issue Nov 9, 2012 · 2 comments

Comments

Projects
None yet
2 participants

onlime commented Nov 9, 2012

I can't get a multi-line cell working. The newline character "\n" seems to ge correctly interpreted and shows up in the Excel sheet, but it won't get wrapped.
I tried calling the ExcelFormat::wrap() method like e.g.:

$wrappedFormat = $book->addFormat();
$wrappedFormat->wrap(true);

$data = array('Date', "Foo\nBar");

// setting wrapped format directly in writeRow()
$sheet->writeRow(0, $data, 0, $wrappedFormat);

// setting wrapped format afterwards
$sheet->writeRow(1, $data);
$sheet->setCellFormat(1, 1, $wrappedFormat);

both won't work. Any idea?

tested on the following systems:

  • OS X 10.8.2, PHP 5.4.8, php_excel 0.9.7 (Macports), libxl 3.2.4 (Macports)
  • Debian Squeeze, PHP 5.4.8, php_excel 0.9.7 (latest from git master), libxl 3.3.1
Owner

iliaal commented Nov 18, 2013

Can you try with libxl 3.5.3 and php_excel 0.9.9?

iliaal closed this Nov 18, 2013

onlime commented Nov 20, 2013

Hi Ilia
Thanks for the fix. It does not yet seem to work, at least not with the following code under libxl 3.5.3.0 / php_excel 0.9.9:

$wrappedFormat = $book->addFormat();
$wrappedFormat->wrap(true);

$data = array('Date', "Foo\nBar");
$sheet->writeRow(0, $data, 0, $wrappedFormat);

The newline character is correctly added as newline character into the xlsx, but it will only break the line as soon as I manually select the "line break" option for the field in Excel (tested on Excel for Mac 2011). Unless I do this, it will just show up as space between "Foo Bar". Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment