OpenOffice Basic
StarOffice Basic ( known as Star Basic and OOoBasic also ) is a BASIC dialect that is the based on IBM Lotus Symphony integrated into the office suites LibreOffice, OpenOffice.org and StarOffice.
Comparison with other Basic dialects
StarBasic has a similarity to other Basic dialects such as Microsoft's VBA. In practice, a macro in StarBasic usually requires more overhead than a macro in the corresponding application from Microsoft with the same functionality. The following is a macro for the Writer (Word Processing program ) OpenOffice is shown above, below the macro with the same function - namely to count the sections of a text document - VBA in Microsoft Word:
Sub Para Count ' ' Paragraphs in a text document count in OpenOffice Basic ' Dim Doc As Object, Enum As Object, Count As Long Doc = ThisComponent ' Is this a text document? If Not Doc.SupportsService ( " com.sun.star.text.TextDocument ") Then MsgBox " This macro must be run from a text document ", 64, "Error" Exit Sub end If Count = 0 ' Every part of the document check - paragraph or table? Enum = Doc.Text.CreateEnumeration while Enum.HasMoreElements Textel = Enum.NextElement ' Is this part of the document, a paragraph? If TextEl.SupportsService ( " com.sun.star.text.Paragraph ") Then Count = Count 1 end If Wend View 'Result: Count MsgBox, 0, " Number of paragraphs " end Sub Sub Para Count () ' ' Paragraphs in a text document count in MS Word Visual Basic ' MsgBox ActiveDocument.Paragraphs.Count end Sub literature
- Thomas Krumbein: Macros in OpenOffice.org Basic 3 / Star Basic entry, Galileo Press, Bonn 2009, ISBN 978-3-8362-1438-4.