Ask Your Question

Calc: char(10) does not copy as text? [closed]

asked 2015-06-25 19:16:34 +0100

MrMusAddict gravatar image

updated 2020-09-24 16:19:20 +0100

Alex Kemp gravatar image


I intended to have a spreadsheet which outputs data into a single copy-able cell, to be pasted into notepad or other text based applications.

In its simplest form, I intended something like this:


Intended output (which shows correctly within Libreoffice):


Output when A4 is copied/pasted as text:


Is there a way around this?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-08-22 16:44:41.368667

2 Answers

Sort by » oldest newest most voted

answered 2015-06-25 21:20:21 +0100

Alex Kemp gravatar image

updated 2015-06-25 23:52:34 +0100

Hi MrMusAddict

I take it that you are working under Windows?

In LO (this is pasting text):

lf == chr(10) == newline

cr == chr(13) == new paragraph

ff == chr(12) == new page

In Linux:

newline = lf

In Apple/Mac:

newline = cr

In Windows:

newline = lf+cr


for standard Windows text files/editors you need chr(10)chr(13) (2 bytes) for each newline.

for standard Linux text files/editors you need chr(10) (1 byte) for each newline.

for standard Apple/Mac text files/editors you need chr(13) (1 byte) for each newline.

LO/OO, however, is different. I do not have experience of Apple/Mac, though I would expect it to be identical to Windows & Linux in which:

  • or Enter == cr == chr(13) == new paragraph
  • Shift + ↲ or Shift + Enter == lf == chr(10) == newline
  • Ctrl + ↲ or Ctrl + Enter == ff == chr(12) == new page

Very simple and, I think, rather clever.

edit flag offensive delete link more


Thank you! I replaced all char(10) with char(13)&char(10), and it is working beautifully :)

MrMusAddict gravatar imageMrMusAddict ( 2015-06-26 00:11:25 +0100 )edit

answered 2015-06-25 21:18:39 +0100

Lupp gravatar image

updated 2015-06-25 21:21:48 +0100

A notepad software/plain text editor on Windows will expect CHAR(13)&CHAR(10) (CR LF) for switching to the next line and make no difference as compared to a new paragraph. A Calc cell will, however, accept the CHAR(10) 'LF' allone as line break for compatibility reasons on Windows, too. Writer will accept the CHAR(10) as hard line break (not new paragraph) on any system if inserted as unformatted text. 'New paragraph' is CHAR(13)&CHAR(10), again. Whether you use CR,LF or LF alone in Calc won't matter for the display. The difference will only show up in the LEN() result or on search for/preparing of the characters themselves.

edit flag offensive delete link more


Although that's the standard just like softwares on NIX systems expect the NIX type, Notepad++ is 1 example of softwares that can toggle between all 3 (DO$, NIX and Mac Classic) for any file currently opened in it. I'm not totally sure but it seems the Nano Editor can change the type, but it seems it's strictly limited to convert a file. Oh well, at least Linux has the §dos2unix§, §unix2dos§ and §unix2mac§ but seemingly not §dos2mac§.

rautamiekka gravatar imagerautamiekka ( 2015-06-25 21:34:12 +0100 )edit

@Lupp: I've worked with Writer under both Linux & Windows & there is zero difference between the two in behaviour on chars entered (recall that the program is reading the kbd codes, not document bytes). I programmed a large macro under Windows that (in the end) explicitly used the difference between LF + CR on entry, and during research for that macro discovered that LF is a newline under LO/OO, CR is a new paragraph & FF a new page.PDF.

Alex Kemp gravatar imageAlex Kemp ( 2015-06-25 21:40:21 +0100 )edit

Question Tools

1 follower


Asked: 2015-06-25 19:16:34 +0100

Seen: 1,190 times

Last updated: Jun 25 '15