Mayrhofer Mayrhofer - 1 year ago 86
PHP Question

create excel line break within string using php xlsx writer

I'm using php xlsx writer (https://github.com/mk-j/PHP_XLSXWriter) to create my excel file and try to figure out how to force excel to make a line break.

My source data contains html tags (

<br />
) and i want to replace them with the correct formular. The replace function is working but i need how the string needs to be formated to force the break.

The line wrap option at format cells is enabled for the column as shown in the picture below (excel is installed german at the moment - please don't hate me for that)

enter image description here

What i tried so far is using
CHAR(10)
and
CHAR(13)
- altough
CHAR(13)
should be for mac and i am on windows.

I tried the following inputs to get my line break working. Also i tried all of the combinations with
\n
and
\r\n
instead of
CHAR(10)
and
CHAR(13)


="text"&CHAR(10)&"text"
='text'&CHAR(10)&'text'
=text&CHAR(10)&text


The data was entered in the formular row in excel (picture below) - i think this is the only possible location to enter this isn't it?

enter image description here

Whatever i try my output always looks like this:

enter image description here

Any suggestions what i could do?

Thanks for your help!

Answer Source

The question got answered in https://github.com/mk-j/PHP_XLSXWriter/issues/114. There was a release of a new brunch supporting new line character which fixed the problem.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download