Let's say we have a series of words separated by commas in a LibreOffice Writer odt document:
"water, air, fire, sky, cloud, rain, snow, ice, wind, sun, moon, star, mountain..."
What is the easiest method to list them in a LO Writer table separated by rows?
Trying to convert them to table (Table → Convert → Text to table → Separate text at "Other" → selecting ,
- the result is that the words are separated by columns (where the commas where), but not by rows.
How to separate them by rows so that they appear as a list?
I am going to do that a lot, that's why I am looking for the "easiest way". I do have a solution but I don't find it easy enough. I am posting it below as an example:
As things are, the "convert to table" option only has options applicable to an existing list with each word on a separate line.
To create the correct lines I have used the addon/extension called "Alternative searching" to replace the spaces between words with Paragraph (ending): \p
.
Then, the method Table → Convert → Text to table → Separate text at Paragraph works.
Just convert the commas to newlines and then copy paste them into your libreooffice document:
You can also redirect to a file if te data are too large to copy and then open the file in libreoffice. Since they are now in rows, it should be trivial to convert to a table with one word per row.
This solution does what terdon's solution essentially does (which I prefer), but I'm adding it here since it can be done from within LibreOffice Writer, without using a terminal.
Select the comma-separated list you want to convert to a single-column table.
Press Ctrl+H (keyboard alternative for Edit → Find and Replace...).
In the Find and Replace dialog that opens check Current selection only and Regular expressions and add:
Find:
,
Replace:
\n
Click Replace All.
You should now have your selection as rows of text.
Finally, to convert the rows to a single-column table: Table → Convert → Text to Table... → set Separate Text at to Paragraph → OK.
An alternative way is to use LibreOffice Calc to transpose the table (convert columns to rows and rows to columns), since Writer doesn't currently have that option:
Convert the list of the comma-separated words to a table as you described in your question.
Copy the table from Writer and paste it to Calc.
Select the pasted row in Calc and press Ctrl+X to cut it.
right-click on a cell and select Paste Special → Transpose.
Finally, copy the column with the words from Calc and paste it to Writer.