Some of the first things I needed to get straight to move from Microsoft Office scripting to Open Office scripting:
- The BASIC isn't quite compatible: I know the object model is completely different, but even the underlying language isn't quite the same. I wanted to use the
InStrRev
function, but it wasn't there! Then I foundoption VBASupport 1
which puts it in. It's (as far as I can tell) undocumented but mentioned all over on the web. I'm not sure what else it changes (again, in the language, not the object model). - The name of the program is OpenOffice.org; evidently Open Office is trademarked by someone else. I'll do my best to comply.
- Sizes are in hundredths of a millimeter (dekamicrons? abbreviated as daµ; I can't find anyone using a better abbreviation), so my code has a lot of
x = y * 2540/72
: 2540 mm per inch, 72 points per inch. - Inserting control elements is more complicated than I would have thought; the object model divides them into "model" and "view" and figuring out which properties belong to which takes some searching and experimenting:
Dim rng as com.sun.star.text.TextRange, checkModel, checkbox checkModel = doc.createInstance("com.sun.star.form.component.CheckBox") checkView = doc.createInstance("com.sun.star.drawing.ControlShape") checkView.control = checkModel rng.Text.insertTextContent(rng, checkView, True)