StarOffice BasicStarOffice Basic (also known as StarBasic) is a dialect of Basic that is included with the OpenOffice.org and StarOffice suites of office software. It supports Unicode. Although StarBasic itself is similar to other dialects of Basic, such as Microsoft's VBA, the API is very different, as the example below of a macro illustrates. \n Sub ParaCount\n '\n ' Count number of paragraphs in a text document\n '\n Dim Doc As Object, Enum As Object, Count As Long\n Doc = ThisComponent\n ' Is this a text document?\n If Not Doc.SupportsService("com.sun.star.text.TextDocument") Then\n MsgBox "This macro must be run from a text document", 64, "Error"\n Exit Sub\n End If\n Count=0\n ' Examine each component - paragraph or table?\n Enum=Doc.Text.CreateEnumeration\n While Enum.HasMoreElements\n TextEl=Enum.NextElement\n ' Is the component a paragraph?\n If TextEl.SupportsService("com.sun.star.text.Paragraph") Then \n Count=Count+1\n End If\n Wend\n 'Display result\n MsgBox Count, 0, "Paragraph Count"\n End Sub \nExternal links |
||
"Blessed is the man, who having nothing to say, abstains from giving wordy evidence of the fact." - George Eliot (1819-1880) |
