Ask Your Question

Calc Remove line breaks when copy/pasting a single cell

asked 2018-07-07 13:28:16 +0200

updated 2018-07-07 13:32:13 +0200

I'm an absolute fan of libre office and I'm totally happy to have this great tool available.

There is a usecase though, where the behaiviour of calc annoys me a lot.

Task: Copy content of a spreadsheet into a pre written text without adding line breaks What I do:

  • select the point where to insert the info from the spreadsheet in your text file
  • go to calc and select the cell with the content. Ctrl+C
  • go to file browser and paste the name + Enter
  • remove the line break that was created after the content
  • repeat until done

Problem is, that when you copy stuff out of calc you don't get only the stuff you see (the content of the cells) but some unneccessary items like (i guess) /n/r. I understand, that those /n/r are not unneccesary when you copy multiple cells. But when you copy a single cell they are not needed. So what I would request is, that if one copys a single cell, only the content of the cell is copied. No linebreaks or tabs are added to the end of the content.

edit retag flag offensive close merge delete


LibO version? OS type, version?

Lupp gravatar imageLupp ( 2018-07-07 16:03:16 +0200 )edit

Ok. It seems my example was no good.

If you go to calc and copy a single cell, than go to an editor of your choice and past it, what happens? Answer: The content of the cell is pasted and the cursor moves to the next line.

Thus: If you would paste the same content in the editor 5x you would get 5 lines with the same content.

I would request that the line break is not included and only the pure content of the cell is pasted.

kevinfleischer gravatar imagekevinfleischer ( 2018-07-07 16:39:33 +0200 )edit

This extra \r\n is unimportant in most situations but annoying when:

  • you paste into file names
  • paste into documents where you want to overwrite a placeholder with the content (Dear Mr. xxxxxxxxx,)
  • probably more...
kevinfleischer gravatar imagekevinfleischer ( 2018-07-07 16:39:51 +0200 )edit

Sorry. an insertion by 'Paste' (or a kind of 'Paste Special') will need a termination. How a different editor (non-LibO) can accept and process the contents of the clipboard isn't under control by LibO - and the clipoard wouldn't accept unterminated content on 'Copy'.
Surely users will need in most cases a delimiter between "things" pasted in different steps or coming from different cells of any spreadsheet.

Lupp gravatar imageLupp ( 2018-07-07 16:51:08 +0200 )edit

A concatenation of texts coming from different cells (hopefully ranges) of sheets of a Calc document without any delimiter or with a specified one (no paragraph break e.g.) you can get inside Calc with the function JOIN() available and working well in V5.3.4 or higher. (There is also the CONCAT() function, but it doesn't anything useful JOIN() couldn't also do.) The omission of the standard delimiter (termination) of each single cell content) cannot resonably be done by the pasting.

Lupp gravatar imageLupp ( 2018-07-07 16:58:31 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-07-07 16:26:27 +0200

Lupp gravatar image

updated 2018-07-07 16:28:41 +0200

I obviously do not understand your problem. Quoting @kevinfleischer:

go to file browser and paste the name + Enter
remove the line break that was created after the content
repeat until done

What "name" do you paste where, actually? Didn't you want to paste into a text document?
What is your "file browser"? Why do you need to paste something there?
Why is there something to repeat?

If you use the 'Copy' command for a Calc cell there go lots of information to some background storage controlled by a service of the operating system (clipboard) and probably in addition some information to a storage range controlled by LibO.

Whenever you 'Paste' or 'Paste Special...' then something somewhere the software getting the command has to decide what model(s) of the copied "thing" from the clipboard (or from the other storage if accessible) it accepts for insertion - if any. It may choose a specific one regarding its own rules or prompt the user for his(f/m) decision. ...
That's not too simple, but in fact it cannot be much simpler, because users have different intentions and target documents have different capabilities.

The attached documents demonstrate what you get with LibreOffice (made with V6.0.4) under Win (V10 up-to-date). Downlosd this source-document and this target-document into the same folder and open them both then. (Accept to update links.)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-07-07 13:28:16 +0200

Seen: 25 times

Last updated: Jul 07