Find & Replace across paragraphs

Discuss the word processor
Post Reply
FGrace
Posts: 1
Joined: Tue Feb 19, 2008 3:43 am

Find & Replace across paragraphs

Post by FGrace »

I want to reformat a text in Writer by removing line end characters and replacing them with blanks. "Find and replace" does not allow the special lineend character to be put into the "find" space, so no joy. Good old DOS had Personal Editor which let users set margins and reset the whole text by pressing ALT-P. Progress should make my simple wish at least that easy, but I can't figure how to do it. Help please.
 Edit: Hagar: changed title. 
User avatar
RevNomad
Posts: 36
Joined: Thu Dec 20, 2007 5:32 pm

Re: Reformat

Post by RevNomad »

I'm not certain but try the enhanced Find and Replace extension.
http://extensions.services.openoffice.org/
NTP
OO.org 2.4 WinXP also OO.org 3 milestones
OOorg 2.4 Kubuntu 7.1 also OO.org 3 milestones
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Reformat

Post by acknak »

Writer has some limitations that prevent it from handling this task well.

E.g., Writer's find and replace cannot match anything across a paragraph boundary, so it's not possible to do something simple like "replace all single paragraph ends with a space, and all multiple pp ends with a single pp end".

You can do it with Find and Replace:
Search for: $
Replace with: (space)
Options / Regular expressions = YES

But if you just click "Replace All", you convert the entire document to one big paragraph, risking corruption of the text if that single paragraph exceeds Writer's ~60,000 character (~50 page) paragraph size limit.

If you use Find and Replace and do one at a time so you can preserve some of the paragraph ends, it's only slightly less tedious than just doing it manually.

That's why the macro is a good suggestion.

I just use a good text editor to prepare text for import into Writer.
AOO4/LO5 • Linux • Fedora 23
User avatar
RevNomad
Posts: 36
Joined: Thu Dec 20, 2007 5:32 pm

Re: Reformat

Post by RevNomad »

I played around a bit with the enhanced find and replace extension. I don't work with large documents so more testing should be done. However my simple experiment suggests it will fit your needs.
NTP
OO.org 2.4 WinXP also OO.org 3 milestones
OOorg 2.4 Kubuntu 7.1 also OO.org 3 milestones
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: Reformat

Post by JohnV »

I have written a macro for this purpose. It will handle large documents and does its best to maintain paragraph breaks where you would actually want them. Tested with Project Gutenberg ebooks which, of course, have hundreds of pages.
http://www.oooforum.org/forum/viewtopic ... ight=ascii
Post Reply