StarOffice Basic

from Wikipedia, the free encyclopedia

StarOffice Basic (also known as StarBasic and OOoBasic ) is a BASIC dialect that is integrated into the LibreOffice , and StarOffice office packages and the IBM Lotus Symphony based on them .

Comparison with other basic dialects

StarBasic is similar to other Basic dialects such as Microsoft's VBA . In practice, a macro in StarBasic usually requires a greater overhead than a macro in the corresponding Microsoft application with the same functionality. In the following, a macro for the Writer ( word processing program ) from OpenOffice is shown above, below the macro with the same function - namely counting the sections of a text document - in VBA from Microsoft Word :

 Sub ParaCount
 ' Absätze in einem Textdokument zählen in OpenOffice Basic
   Dim Doc As Object, Enum As Object, Count As Long
   Doc = ThisComponent
 ' Ist dies ein Textdokument?
   If Not Doc.SupportsService("") Then
     MsgBox "Dieses Makro muss aus einem Textdokument ausgeführt werden", 64, "Error"
     Exit Sub
   End If
   Count = 0
 ' Jeden Teil des Dokuments überprüfen - Absatz oder Tabelle?
   Enum = Doc.Text.CreateEnumeration
   While Enum.HasMoreElements
     TextEl = Enum.NextElement
 ' Ist dieser Teil des Dokuments ein Absatz?
     If TextEl.SupportsService("") Then 
     Count = Count + 1
     End If
 'Ergebnis anzeigen:
   MsgBox Count, 0, "Anzahl der Absätze"
 End Sub
Sub ParaCount()
 ' Absätze in einem Textdokument zählen in MS Word Visual Basic
  MsgBox ActiveDocument.Paragraphs.Count
End Sub


  • Thomas Krumbein: Macro Cookbook. LibreOffice / OpenOffice Basic , Tintal Verlag, Wiesbaden 2013, ISBN 978-3-9437-7102-2 .

Web links

BASIC macros

StarOffice / API