# Is there a way to globally reduce the number of hard returns

for instance I download text stories and in some of these there are 3 or 4 or more hard returns between paragraphs. Is there a way to globally reduce these to 2 hard returns so there is only one blank line between paragraphs? Thank you for your time

edit retag close merge delete

Sort by » oldest newest most voted

I'd suggest you using Alternative dialog Find & Replace for Writer (AltSearch) extension: https://extensions.libreoffice.org/ex...

more

Sorry. My posting had to sleep for a while, and then crossed yours.

( 2017-01-19 12:47:15 +0200 )edit

Find and replace with regular expressions enabled; search say \n\n\n (three hard returns) and replace with \n\n. Repeat as necessary.

more

AFAICS it won't work; in standard LO replace dialog, the regular expressions are limited to one paragraph.

( 2017-01-19 12:29:21 +0200 )edit

@robleyd obviously assumed your (theOQ's) "hard returns" were hard line breaks (Shift+Enter) while you had empty paragraphs in mind.
F&R cannot handle this as you correctly stated. The extension AltSearch can (to some degree).

more

This solution is not elegant, but it works to modify an entire document by replacing multiple (and variable numbers of) hard returns with single instances. Steps: 1. In the Find & Replace dialog box make sure under ‘Other options’ that ‘Regular expressions’ is checked, search for ‘$’ (no quotes), replace all with some flag or placeholder, e.g. ‘QWERTY’ 2. Use Find & Replace again, but with ‘Regular expressions’ unchecked, to remove multiple flags, leaving only those where you want a hard return. 3. Use Find & Replace, with ‘Regular expressions’ checked, to find all the remaining flags and replace them with ‘\n’ (no quotes). (Edited by @Lupp:) Please note the third comment below concerning hard page breaks. more ## Comments (Just kidding?) Replacing all the$ with the chosen next_paragraph placeholder will make one single paragraph of all the text. As there is still a limit of 2 147 483 647 characters per paragraph the method may already fail for Writer documents of only about 50 000 pages.
(Up to LibO Writer V 4.2 the limit was only 65535. A significant limitation! Apache OpenOffice did not raise this limit yet.)

( 2017-01-21 11:29:53 +0200 )edit

To remove all the multiple placeholders (QWERTY your example) I would suggest you work still with 'Regular expressions and 'Serch For' (QWERTY){2,}, 'Replace With' (empty).

( 2017-01-21 11:36:06 +0200 )edit

Be aware of the fact that the workaround will spoil the hard page breaks if applied to the complete document or to a selection containing such breaks.

( 2017-01-21 11:44:13 +0200 )edit

@Mike Kaganski: It works … →search: ^\$ and replace with nothing, deletes any empty paragraph, and of course the distance between two Paragraphs should be regulated through the Paragraph-Format Settings.

more

:) What works is what you posted, but that's not what OP wants, neither what was suggested as solution. I refrain from arbitrarily modifying OP's intent; I may figure quite a number of cases where using paragraphs is OK.

( 2017-01-19 13:49:24 +0200 )edit

I has read the OP-post … and I repeat: Don't try to "layout" your Docs with manually putting "whitespace"

( 2017-01-19 15:38:16 +0200 )edit

Please don't do that. No one here tried to manually layout anything here - that's you who insists on things irrelevant to discussed topic. OP gets the text from external source; that source isn't formatted as required - and needn't be, as it's apparently not a office-format. OP doesn't express desire to spend time for (possibly substantial) work on "proper" formatting of (possibly one-time-read) texts; and so his question is OK (although template approach is also viable, but possibly overkill).

( 2017-01-19 16:20:00 +0200 )edit

The OP ask for …replace by exactly one empty Paragraph thats IHMO manual Layout by whitespace.

( 2017-01-19 18:08:36 +0200 )edit