Ask Your Question

Select every other line in Writer?

asked 2021-01-06 17:10:31 +0200

dexl gravatar image

updated 2021-01-06 17:12:46 +0200

I would like to automatically select every other line in Writer to copy the text and move it to another column. There are hundreds of lines. Is that even possible?

Alternatively, what's the easiest way to automatically put every other line of text in another column?

edit retag flag offensive close merge delete



What's a line in your diction here?
Writer doesn't know lines generally. What we call lines in a view is mostly the result of automatic wrapping.
You surely mean "lines" created by paragraph breaks (Enter) or by hard line breaks (Shift+Enter) explicitly.
Or are you actually talking of subsequent cells in a column of a TextTable? If not, what do you mean by "another column" then?

It's very easy to waste lots of time by exaggerating supposed conciseness. And it's not just your time!

Lupp gravatar imageLupp ( 2021-01-07 14:26:06 +0200 )edit

As always: Upload an example showing
-1- What you start with
-2- What you want to get.
Any ambiguities should be resolved by additional explanations (probably inside the example).

Your "karma" is sufficient for uploading.

Lupp gravatar imageLupp ( 2021-01-07 14:32:14 +0200 )edit

A multiselection of text regions can only be created in the view manually or by a Find All using F&R (UI means).
Concerning F&R with regular expressions there is no RegEx finding every other paragraph break. Even resorting to user code, I don't know a way to create the needed object.
However: If all the "lines" actually are paragraphs of one flowing text, it can be done inside Writer by a sequence of steps using UI tools. It's only efficient if there are (at least) dozens of "lines" per case.
If this is your situation, please tell. I will take the time then to desribe the proceeding.

Lupp gravatar imageLupp ( 2021-01-07 14:52:02 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2021-01-07 13:53:57 +0200

LeroyG gravatar image

updated 2021-01-07 13:54:52 +0200

An all-Writer answer (assuming that text is in a table).

  • Add columns B¹ and C, and copy the text to column B:

    1. Select from cell A2 to the end (click on A2 and press Ctrl+Shift+End)
    2. Copy selected cells (Ctrl+C)
    3. Add two columns after (choose menu Table - Insert - Columns After or click twice on the Columns After icon)
    4. Paste copied text in column B (click on cell B1, Ctrl+V) (last cell will remain empty)
  • Add alternate content in column C and sort table by content in column C:

    1. Type something in C1 (could be a)
    2. Select C1:C2 (click on C1 and drag to C2, or, while the cursor is in C1, Shift+Down Arrow)
    3. Copy selected cells C1:C2 (Ctrl+C)
    4. Select following cells in column C (Ctrl+Shift+End)
    5. Paste copied cells (C1:C2) to column C (Ctrl+V)
    6. Select all table (Ctrl+A)
    7. Sort table content by column C (choose menu Table - Sort…, check Key 1, and choose 3 for Column, OK)
  • Delete the rows and column with the now unnecessary text:

    1. Select rows without content in the third column (scroll down until the middle of the table, click on the last empty cell of column C, press Ctrl+Shift+Home)
    2. Delete rows without content in the third column (choose menu Table - Delete - Rows, or click on the Delete selected rows icon)
    3. Delete column C (click on column C, choose menu Table - Delete - Columns or click on the Delete selected columns icon)

¹ You can see table and cell names in the status bar: image description

Tested with LibreOffice (x64); OS: Windows 10.0.

Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

Check the mark (Answer markCorrect answer mark) to the left of the answer that solves your question.

If the answer helped you, you can mark the up arrow (Upvote mark) that is on the left (to vote, you need to have karma of at least 5).

edit flag offensive delete link more

answered 2021-01-07 06:14:02 +0200

Earnest Al gravatar image

updated 2021-01-07 06:23:28 +0200

The easiest way, well, the way I would do it would be to copy the list to Calc and paste it at A1.

In Calc, cell B1 enter the formula =IF(MOD(ROW();2);A1;""), in Cell C1 enter the formula =IF(MOD(ROW();2);A2;""). Drag the two formulas down to the end of the list, or copy and paste.

Copy all the cells in columns B & C containing the formulas and press Edit > Paste Special Paste unformatted text.

In the menu press Data > AutoFilter (say no if it wants first row as column headers). Click on the filter arrow by one of the columns and untick the box Empty Cells, click OK.

With the cells still selected copy and paste into Writer as unformatted text to get just tabs between the words and convert to table if needed. Cheers, Al

Alternate rows in Writer and in Calc

edit flag offensive delete link more


@Earnest Al, Adding my ideas to yours (second paragraph):

In cell B1 enter the formula =A1, in Cell C1 enter the formula =A2. Select B1:C2 and drag the two formulas down to the end of the list, or copy and paste, or double click on the fill square (highlighted with red in the next image).

image description

LeroyG gravatar imageLeroyG ( 2021-01-07 12:53:27 +0200 )edit

That's better. I always seem to default to Mod().

Earnest Al gravatar imageEarnest Al ( 2021-01-08 10:30:05 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-01-06 17:10:31 +0200

Seen: 38 times

Last updated: Jan 07