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?

-- 
Rory O'Farrell <[email protected]>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to