[Solved] Replace paragraph marks with line breaks

Discuss the word processor
Locked
dgolber
Posts: 5
Joined: Mon Sep 01, 2025 3:21 pm

[Solved] Replace paragraph marks with line breaks

Post by dgolber »

How can I (in the whole document) replace paragraph marks by manual line breaks?
Last edited by MrProgrammer on Sun Sep 07, 2025 8:39 pm, edited 2 times in total.
Open Office 4.1.15 on Windows 11 Home
User avatar
RoryOF
Moderator
Posts: 35103
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Replace paragraph by manual line breaks

Post by RoryOF »

Why? What do you wish to achieve?

If you wish to replace line breaks (which show up as a left pointing hooked arrow when /View /Non printing characters is enabled), do this

Find \n
Replace \n
Drop More Options and check Regular Expressions.
Press "Replace all" button
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
User avatar
Hagar Delest
Moderator
Posts: 33482
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Replace paragraph by manual line breaks

Post by Hagar Delest »

Technically, I think that there is still the limitation of 64k characters per paragraph.
Meaning that if your file exceeds this number of characters, then you'll have a problem.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
User avatar
RoryOF
Moderator
Posts: 35103
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Replace paragraph by manual line breaks

Post by RoryOF »

Thanks, Hagar; I had forgotten about the OpenOffice 64K paragraph limitation.

But the replacement \n will be Paragraph breaks, not line breaks, so the limitation should not come into play.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
User avatar
MrProgrammer
Moderator
Posts: 5347
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Replace paragraph by manual line breaks

Post by MrProgrammer »

dgolber wrote: Mon Sep 01, 2025 3:32 pm How can I (in the whole document) replace paragraph marks by manual line breaks?
This seems like a very bad idea. I decline to help people with shooting themselves in the foot. If you proceed with this task I recommend that you save a pre-damaged version of your document, since it seems likely you will want to revert to that after you discover what difficulties have been introduced. Paragraphs are fundamental to Writer. It is impossible to eliminate the final paragraph mark, since text in a document must be contained in a paragraph.

If you were to somehow eliminate all the other paragraph marks in your document, you would turn it into one giant paragraph. There are two problems with that:
• OpenOffice has a limit of 65535 characters per paragraph.
• You will be limited to a single paragraph style, and since some text properties are controlled by the paragraph style (like the text indentation, alignment, line spacing, tab settings, etc.) you will not be able to set those properties independently for different sections of your text. The giant paragraph would assume the settings of the paragraph which was originally first.

Read about styles in Help → Index or in User Guides (PDF) or searching for topics about this in the Writer Forum.

If you can explain your goal and why you want to eliminate all of your paragraph marks, perhaps someone can suggest an alternate path to the goal which does not involve replacing paragraph marks by line breaks. Attach a document demonstrating the situation (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself). I will not help further unless you attach. Don't just make an attachment; we also need to know how you want to change the docuent.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
RoryOF
Moderator
Posts: 35103
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Replace paragraph by manual line breaks

Post by RoryOF »

If they are actually line breaks, you need to mark the ends of paragraphs by an empty paragraph. Then execute the following sequences:

Find ^$
Replace %%%%
Drop More Options, check Regular expressions.
Press Replace All button
Then
Find \n
Replace <space character>
Press Replace All button
Then
Find %%%%
Replace \n
Press Replace All.

Now all Line Breaks will have been replaced with space characters. Each paragraph will remain as a paragraph, so you ought not run into OpenOffice's 64K paragraph limitation.

You may have a little editing to do, removing a small number of funny hyphenations.

In case of disaster (and it lurks!) best to work on a copy of the file.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
User avatar
Hagar Delest
Moderator
Posts: 33482
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Replace paragraph by manual line breaks

Post by Hagar Delest »

RoryOF wrote: Mon Sep 01, 2025 5:41 pm But the replacement \n will be Paragraph breaks, not line breaks, so the limitation should not come into play.
Sure, it was just a comment on the initial question.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
erbsenzahl
Volunteer
Posts: 264
Joined: Tue Apr 18, 2017 8:23 am
Location: Germany

Re: Replace paragraph marks by manual line breaks

Post by erbsenzahl »

Should work on LibreOffice and OpenOffice
AltSearch.oxt (latest version 1.5.1.2)
https://extensions.libreoffice.org/en/extensions/show/70066

SEARCH

Code: Select all

\p
REPLACE

Code: Select all

\n
----------------------------------
Using regular SEARCH&REPLACE

Step 1
Copy a manual line break

Step 2
  • Start regular SEARCH&REPLACE
  • ☒ regular expressions
  • SEARCH ALL

    Code: Select all

    $
  • Leave regular SEARCH&REPLACE - the paragraph marks are still highlighted
  • Hit shortcut CTRL + V
  • Each highlighted paragraph mark should be replaced by a manual line break
LibreOffice current versions 24.x/25.x and OpenOffice 4.1.15
on LinuxMint 21 - 22 Mate, W10-64 pro
User avatar
floris v
Volunteer
Posts: 4581
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Replace paragraph marks by manual line breaks

Post by floris v »

Maybe the OP is confused about the terminology. He probably has a text with paragraph breaks at the end of every line, and he wants to get rid of them. Then we have the classical situation. Note that he hasn't been back since posting.
LibreOffice 24.2.7.2 on Ubuntu Linux
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
Hagar Delest
Moderator
Posts: 33482
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Replace paragraph marks by manual line breaks

Post by Hagar Delest »

Nice guess indeed!
It would make perfect sense.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
User avatar
MrProgrammer
Moderator
Posts: 5347
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Replace paragraph marks by manual line breaks

Post by MrProgrammer »

floris v wrote: Tue Sep 02, 2025 10:42 pm He probably has a text with paragraph breaks at the end of every line, and he wants to get rid of them.
[Tutorial] Combine paragraph fragments with AutoCorrect
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
dgolber
Posts: 5
Joined: Mon Sep 01, 2025 3:21 pm

Re: Replace paragraph marks by manual line breaks

Post by dgolber »

I want to do this because I have found that certain email applications do weird things with paragraph markings ... like turning them into double line spaces. New-line works better.

Some comments:
(1) \n in one place means something different from \n in another place? Sound like bad programming to me.
(2) Microsoft Word does this with no trouble at all: Replace ^p by ^l. Yes, the final ^p is never replaced.
(3) What I did: Created a message in Open Office Text. Saved it as a Word .doc file. Used Word to change ^p to ^l.
(4) New Windows 11 machine. My old Word works only half way. No longer at ease in the new dispensation.
Open Office 4.1.15 on Windows 11 Home
User avatar
floris v
Volunteer
Posts: 4581
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Replace paragraph marks by manual line breaks

Post by floris v »

That explains a lot. It would have been better if you had added your reasons for doing this in your first post.
Re your (1): I'm with you. (2): While Word doesn't squeak if you do that in a well formatted document, you will lose much of the formatting if you do that.
You can install the AltSearch extension. That allows you to find and replace across paragraphs, and to replace \p with \n, where \n represents a line break.
LibreOffice 24.2.7.2 on Ubuntu Linux
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
JeJe
Volunteer
Posts: 3109
Joined: Wed Mar 09, 2016 2:40 pm

Re: Replace paragraph marks by manual line breaks

Post by JeJe »

I'd use Altsearch as well.

If formatting doesn't matter there is another cumbersome way by saving the document as a Text Encoded file which gives you the choice of LF (line feed) as the paragraph break character. You can then close and open the saved file choosing LF again.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 3109
Joined: Wed Mar 09, 2016 2:40 pm

Re: Replace paragraph marks by manual line breaks

Post by JeJe »

There are also text editors like Notepad++ which allow you to do the conversion or to edit as a document with the LF as the paragraph character.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
dgolber
Posts: 5
Joined: Mon Sep 01, 2025 3:21 pm

Re: Replace paragraph marks by manual line breaks

Post by dgolber »

Thank you Floris. That works.
Open Office 4.1.15 on Windows 11 Home
Locked