Thanks. That's helpful, even if a bit clunky.
On 17 Jul 2012 at 19:41, Rory O'Farrell wrote: Send reply to: [email protected] Date sent: Tue, 17 Jul 2012 19:41:28 +0100 From: "Rory O'Farrell" <[email protected]> To: [email protected] Subject: Re: Macro or its equivalent to replace double spaces with single space. > On Tue, 17 Jul 2012 19:26:21 +0100 > "Niall Martin" <[email protected]> wrote: > > > That's the sort of thing I used to do in Lotus Wordpro -- and > > similar for redundant carriage returns -- and find difficult to do > > on Writer. Put spaces and carriage returns etc in quotes or? If > > there is a simple way of doing it in find and replace it is really > > much better than setting up macros and the like. That's for techies > > not moderately experienced ordinary users. > > > > On 17 Jul 2012 at 18:21, Rory O'Farrell wrote: > > > > Send reply to: [email protected] > > Date sent: Tue, 17 Jul 2012 18:21:42 +0100 > > >From: "Rory O'Farrell" <[email protected]> > > To: [email protected] > > Subject: Re: Macro or its equivalent to replace double > > spaces with single space. > > > > > On Tue, 17 Jul 2012 13:06:30 -0400 > > > Doug <[email protected]> wrote: > > > > > > > On 07/17/2012 07:06 AM, Rory O'Farrell wrote: > > > > > On Tue, 17 Jul 2012 12:47:01 +0200 > > > > > Johnny Rosenberg<[email protected]> wrote: > > > > > > > > > >> 2012/7/17 Srinivasulu Bhattaram<[email protected]>: > > > > >>> I am new to Open Office. > > > > >>> InWORD 2003 (and also in WORD 2007), > > > > >>> I have craeted macros to remove double spaces with single > > > > >>> spaces and used them extensively.. How to have an equivalent > > > > >>> of it in Open Office writer? > > > > >>> > > > > >>> I do not want to go through Find Replace.... kind of > > > > >>> thing. seena > > > > >> What about letting a macro do the search and replace for you? > > > > >> > > > > >> I just wrote this one, with inspiration from ”Useful Macro > > > > >> Information For OpenOffice.org By Andrew Pitonyak”, which > > > > >> is a PDF that you can download somewhere: > > > > >> > > > > >> REM ***** BASIC ***** > > > > >> > > > > >> Sub RemoveRedundantSpaces > > > > >> Dim oReplace as object > > > > >> oReplace = ThisComponent.createReplaceDescriptor() > > > > >> > > > > >> With oReplace > > > > >> .SearchString = " " > > > > >> .ReplaceString = " " > > > > >> End With > > > > >> > > > > >> While ThisComponent.ReplaceAll(oReplace)>0 > > > > >> Wend > > > > >> End Sub > > > > >> > > > > >> > > > > >> This macro also takes care of tripple spaces and… well, it > > > > >> just removes all spaces until there are only single spaces > > > > >> left. And it is fast. Really fast. I tested it myself, and it > > > > >> worked in all my test cases. Well, I didn't test it THAT > > > > >> thoroughly, but still… > > > > >> > > > > >> Much better than using the crappy macro recorder anyway. And > > > > >> shorter… > > > > >> > > > > >> If you write the documents yourself, there is a simple way to > > > > >> prevent double spaces in the first place, something like: > > > > >> Tools → Options for auto correction… → Click the > > > > >> Options tab → ☒ Ignore double spaces > > > > >> > > > > >> You can still make double spaces if you really want to, but > > > > >> it's less likely to happen accidently. > > > > >> > > > > >> > > > > >> Kind regards > > > > >> > > > > >> Johnny Rosenberg > > > > >> ジョニー・ローゼンバーグ > > > > >> > > > > > Or why not use the Language Tool extension, which will flag > > > > > double spaces as you type with a blue wiggly underline? > > > > > > > > > That wouldn't help with text that is already written, that > > > > you're editing. --doug > > > > > > When I have redundant double spaces, I use Find and Replace to > > > search for them and replace them. Quick and simple - no need for > > > any macros. > > > > > > > > In Find box insert " " (two spaces, no quotes). > In Replace box insert " " (one space, no quotes). > Check More Options does not have Regular Expressions checked, > Press Replace All. > > End of paragraph marks are trickier - I usually use AltSearch from the > extensions repository. OpenOffice has problems with paragraphs longer > than 64K, so care is needed. Usually I search for double paragraph > marks and replace with %%%% (or some other token not used in the > file). Then I search for single paragraph marks and replace with a > space. Finaly I search for %%%% and replace with a single paragraph > mark. I use such a sequence when I download books in plain text, > before reformatting to suit my requirements. > > -- > Rory O'Farrell <[email protected]> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] For > additional commands, e-mail: [email protected] > Niall Martin Phone 0131 4678468 Please reply to: niall<at>rndmartin.cix.co.uk --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
