Bug 143138 - Pasting unformatted text should advance table cells
Summary: Pasting unformatted text should advance table cells
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.1.3.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 95741 104127 149930 (view as bug list)
Depends on:
Blocks: Paste Writer-Tables-Select Writer-Tables-Enhancements
  Show dependency treegraph
 
Reported: 2021-06-30 17:34 UTC by Jakub
Modified: 2023-01-25 07:15 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Comparison between what I want to get (left) and what I get (right) (54.76 KB, image/png)
2021-06-30 17:35 UTC, Jakub
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub 2021-06-30 17:34:12 UTC
Description:
After creating a table in LibreOffice Writer, I tried to paste some data copied from STDOUT (unformatted text, it was a set dates, every date in a new line). If the cursor was in a particular cell, the text was pasted into the cell (which is OK), but when I highlight the whole column and paste, every cell gets the whole set instead of just one line. When I tried that in MS Word with the same unformatted text, I got the desired result. It also works if I paste the text into Calc, then copy from Calc and paste into Writer.

Steps to Reproduce:
1. Copy some unformatted text with more than one line.
2. Create a table in LibreOffice Writer.
3. Highlight one column and paste.

Actual Results:
Every cell gets all the text from clipboard.

Expected Results:
Every cell should get just one line.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 7.1.3.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: kf5
Locale: pl-PL (pl_PL.UTF-8); UI: pl-PL
7.1.3-2
Calc: threaded
Comment 1 Jakub 2021-06-30 17:35:21 UTC
Created attachment 173295 [details]
Comparison between what I want to get (left) and what I get (right)
Comment 2 Mike Kaganski 2021-06-30 18:56:52 UTC
(In reply to Jakub from comment #0)
> When I tried that in
> MS Word with the same unformatted text, I got the desired result.

Oh? I tried this right now with Word 2016, and couldn't get such a result - either using text from terminal (cmd.exe or cygwin), nor from plain-text editors like notepad.

Note that Writer includes a method to *convert text to table* (under menu Table->Convert), which is the intended workflow in such a case: you paste not into existing table, but into main text flow, then select and convert to table.

I have no idea how to implement the *option* to split text to rows - and then, what about columns? Do we need a full CSV import dialog like in Calc?

My take would be WONTFIX, because it is a rarely-needed function that has a reasonable substitution. Asking UX for opinions.
Comment 3 Mike Kaganski 2021-06-30 19:06:39 UTC
(In reply to Mike Kaganski from comment #2)
> Oh? I tried this right now with Word 2016, and couldn't get such a result -
> either using text from terminal (cmd.exe or cygwin), nor from plain-text
> editors like notepad.

I see now: that works when the table is pre-selected only, not when the cursor is in the first cell of a range (as was my intuitive expectation). Maybe that could be the good option: repeat not the whole clipboard content into every selected cell, but iterate element by element - which, for a single copied line, would be equivalent to what happens now, and for multiple cells, would be what Jakub asks for. Only do that for plain text ...
Comment 4 Heiko Tietze 2021-07-02 09:25:17 UTC
It's not a rare use case, stumble over it myself from time to time. Guess there is a duplicate...

If the clipboard content contains tabs it should go into the next column (what happens when it's not selected, eg. "1 /t 2 /t 3" but only 'A' or 'A and B' is selected?; what happens when the table has less columns?) and line feed continues at the next row (what if those cells are not selected, eg. 1 \n 2 \n 3 \n 4 and only 1 and 2 are selected?; what happens when the table has less rows?).

Please check MSO what happen in these cases.
Comment 5 Heiko Tietze 2022-03-18 09:48:26 UTC
If the unformatted text is pasted into a table it should do what Jakub suggests in c1. If the table has not enough rows or columns it should be added. If a selection has been made the paste operation should work only on this subset. If the text to be pasted exceeds the selection a warning "Not all content has been pasted" should tell the user what happened.
Comment 6 Heiko Tietze 2022-03-18 09:50:12 UTC
*** Bug 95741 has been marked as a duplicate of this bug. ***
Comment 7 Heiko Tietze 2022-03-18 09:50:29 UTC
*** Bug 104127 has been marked as a duplicate of this bug. ***
Comment 8 V Stuart Foote 2022-07-09 23:38:02 UTC
*** Bug 149930 has been marked as a duplicate of this bug. ***
Comment 9 Josh Triplett 2023-01-25 07:15:03 UTC
I've run into this as well, quite regularly.

I have a Writer document that I use as a template, copying and filling it out regularly, with a table in it. I generate data for different columns of that table via the command-line, putting it in the clipboard.

What I'd *like* to do is paste directly into that table and have the data spread across rows.

What I end up doing instead is opening Libreoffice Calc, pasting there which *does* default to automatically splitting across rows, then copying the resulting rows and pasting into Writer, which spreads across rows there.

That's a cumbersome workflow, and I'd love to *just* use Writer for this.