[Solved] Line break in function result

Discuss the spreadsheet application
Post Reply
Sykes
Posts: 5
Joined: Thu Mar 31, 2011 11:28 pm

[Solved] Line break in function result

Post by Sykes »

One more request for today :)

I need a line break in the function result. Something like

=A1&"SOMETHING"&A2

where SOMETHING is a line break.

Can I do that somehow? While I can do Ctrl+Enter in the cell, it won't affect the function and the text is not split into 2 rows within the cell.

Thank you!
Last edited by Sykes on Thu Jan 30, 2014 11:11 am, edited 1 time in total.
User avatar
keme
Volunteer
Posts: 3783
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Line break in function result

Post by keme »

The newline is control character number 10. It is not directly accessible from keyboard to insert into literal strings, so you need the CHAR() function:
=A1&CHAR(10)&A2
Apache OO 4.1.12 and LibreOffice 7.5, mostly on Ms Windows 10
Sykes
Posts: 5
Joined: Thu Mar 31, 2011 11:28 pm

Re: Line break in function result

Post by Sykes »

Thanks again. I thought it's gonna be something like this, unfortunately this useful info is not documented.

If I ever go to Norway, I'll buy you a beer :mrgreen:
OOo 3.2 1 @ WXP
User avatar
MrProgrammer
Moderator
Posts: 5310
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: [Solved] Line break in function result

Post by MrProgrammer »

Sykes wrote:… unfortunately this useful info is not documented.
But it is.
Help > Index > [color=#FF0000]line breaks;in cells[/color] wrote:You can use the text function CHAR(10) to insert a newline character into a text formula.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
keme
Volunteer
Posts: 3783
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: [Solved] Line break in function result

Post by keme »

MrProgrammer wrote:
Sykes wrote:… unfortunately this useful info is not documented.
But it is.
Help > Index > [color=#FF0000]line breaks;in cells[/color] wrote:You can use the text function CHAR(10) to insert a newline character into a text formula.
I'll still take that beer, if chance allows ;)
Apache OO 4.1.12 and LibreOffice 7.5, mostly on Ms Windows 10
Post Reply