Phpword: new line in template

Created on 18 Jul 2016  路  4Comments  路  Source: PHPOffice/PHPWord

I'm using template processo for create a word document.
setValue method work fine, but i need set 3 strings in 3 lines.

String1
String2
String3

I have tried to add "\n"

String1\nString2\nString3

but this work fine ONLY with libreoffice, with microsoft office doesn't work fine.

I have tried to add '< w : b r / >' (without space) but dosen't work on libreoffice

Any suggestions?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Most helpful comment

@antho2930 @SalvatorePollaci You need to replace \n with </w:t><w:br/><w:t> the replacement string is without the \n. See https://github.com/PHPOffice/PHPWord/issues/268

All 4 comments

I just tried with "< w : b r / >\n" (without space) and it seems to work both in MS Office and LibreOffice.

@antho2930 Your solution is working for me but new lines are prefixed with an intial whitespace.

@antho2930 @SalvatorePollaci You need to replace \n with </w:t><w:br/><w:t> the replacement string is without the \n. See https://github.com/PHPOffice/PHPWord/issues/268

@antho2930 @SalvatorePollaci You need to replace \n with </w:t><w:br/><w:t> the replacement string is without the \n. See #268

How i can add <hr> horizontal line like <br> (</w:t><w:br/><w:t>)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jt6a74 picture jt6a74  路  5Comments

phuwin picture phuwin  路  3Comments

igorsantos07 picture igorsantos07  路  3Comments

Joel-James picture Joel-James  路  3Comments

ahmednawazbutt picture ahmednawazbutt  路  3Comments