OpenOffice.org: Replacing dingbats

I _really_ should have blogged this when I first wrote it. That would’ve saved me time writing it again!

Sub ReplaceDingbats(optional doc)
	oDocument = IIf(IsMissing(doc), ThisComponent, doc)
	oSearchDesc = oDocument.createSearchDescriptor	
	for i = 1 to 9 
		oSearchDesc.searchString = "(;; )?\(" + i + "\)"
		oSearchDesc.searchRegularExpression = true
		mFound = oDocument.findFirst(oSearchDesc)
		do while not isNull(mFound)
			mFound.string = chr(&HF08B + i)
			mFound.CharFontName = "Wingdings"
			mFound = oDocument.findNext(mFound.End, oSearchDesc)
		loop
	next i
End Sub

It’s a macro for OpenOffice.org – replaces the widgets I use in formatting the book chapter…

  • http://knusper.says.it Knusper

    You use emacs, but write your book with Open Office… I don’t get it. Have you ever tried Auctex?

  • http://sachachua.com Sacha Chua

    I use Org in Emacs to draft everything, then I export it as HTML, then I open up the HTML and copy it into OpenOffice.org so that I can format it according to the publisher’s template, making liberal use of Org and OpenOffice.org tweaks to make my life easier. =) Does that make sense now? Wouldn’t do it if it didn’t need formatting.

    I used to write my lab reports using auctex. That was quite fun, actually.