I would like to replace all paragraph breaks (enter) with line breaks (shift/enter). Is there an expression for line break in the Replace box?
It is easy to replace line breaks with paragraph breaks with Search = \n (finds line break) and Replace = \n (replaces with paragraph break).
I have searched extensively but can only find things saying it cannot be done ...
All help will be appreciated.
[Solved-Workaround] Replace paragraph break with line break
[Solved-Workaround] Replace paragraph break with line break
Last edited by John_Ha on Fri Feb 14, 2014 9:43 pm, edited 1 time in total.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Replace paragraph break with line break (soft return)
This is a very bad idea in OpenOffice (if it is even possible). OpenOffice does not like (read: really hates) paragraphs longer than 64K characters; Line breaks do not read as paragraph breaks, and one can end up with documents that will take no further input.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: Replace paragraph break with line break (soft return)
Rory
Thanks. I agree wholeheartedly! ...
... but I have a special purpose here which applies only to the text I have in one table, so it doesn't spread to the whole document.
I regularly get sent a fairly complex table where the non-WP-literate person uses about 50 paragraph returns instead of line breaks. I just want to change them to line breaks instead of doing them manually.
I know I could Format > Paragraph and set gap to zero, but that interferes with something else. I really do want line breaks!
Thanks. I agree wholeheartedly! ...
... but I have a special purpose here which applies only to the text I have in one table, so it doesn't spread to the whole document.
I regularly get sent a fairly complex table where the non-WP-literate person uses about 50 paragraph returns instead of line breaks. I just want to change them to line breaks instead of doing them manually.
I know I could Format > Paragraph and set gap to zero, but that interferes with something else. I really do want line breaks!
Last edited by John_Ha on Fri Feb 14, 2014 4:22 pm, edited 1 time in total.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Replace paragraph break with line break (soft return)
No--that's the only problem.John_Ha wrote:I would like to replace all paragraph breaks (enter) with line breaks (shift/enter). Is there an expression for line break in the Replace box? ...
OO running on Linux will accept a literal "line feed" character in the "replace with" field, but not on WIndows or Mac.
Hmm ... a simple workaround just occurred to me and it seems to work just fine:
Enter a line break normally and copy it to the clipboard
Edit > Find & Replace
Search for: $
Options/Regular expressions: ON
Click "Find All"
Edit > Paste
AOO4/LO5 • Linux • Fedora 23
Re: Replace paragraph break with line break (soft return)
Very slick, acknak! A new solution to a very old problem.
- MrProgrammer
- Moderator
- Posts: 5266
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Replace paragraph break with line break (soft return)
Macs can easily insert a line feed in the Replace With box using the Mac's Show Character Viewer feature. It works with any application.acknak wrote:OO running on Linux will accept a literal "line feed" character in the "replace with" field, but not on WIndows or Mac.
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).
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).
Re: Replace paragraph break with line break (soft return)
Oops
Trying to write from memory again. Thanks!
It may work on Windows too, now. It's been a long time (WinXP) since I checked.

It may work on Windows too, now. It's been a long time (WinXP) since I checked.
AOO4/LO5 • Linux • Fedora 23
Re: Replace paragraph break with line break (soft return)
acknakacknak wrote:Hmm ... a simple workaround just occurred to me and it seems to work just fine:
Thanks - that is very neat. All I need to get that to work in a macro is a way to load the clipboard with the copied line break ...
I have tried all possible ways using Find and replace, but the Replace box always refuses to recognise the copied soft line break, and does not accept \x000A or \#09, so it pastes a nul, which effectively deletes the paragraph return. I have the Alt Find & Replace add-on which does exactly what I want using \n as the Replace term so I looked inside the add-on and I think the actual expression it uses (line 3553) is as below (I hope your Czech is better than mine!):
Code: Select all
case "t" ' vložit tabulator
prCurs.string = chr(9) ' vlozit text
prCurs.collapseToEnd
case "n" ' vložit line break
prCurs.text.insertControlCharacter(prCurs, com.sun.star.text.ControlCharacter.LINE_BREAK, false )
prCurs.collapseToEnd
case "S" ' vlozit pevnou mezeru
prCurs.text.insertControlCharacter(prCurs, com.sun.star.text.ControlCharacter.HARD_SPACE, false )
prCurs.collapseToEnd
I tried to record a macro when I used Alt Find & Replace. It did the changes I want, but the Stop Recording window disappeared and I couldn't save what I had recorded.
I think I will have to use your method (or Alt Find & Replace) manually after the macro has run doing everything else.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.