World Library  
Flag as Inappropriate
Email this Article

OpenOffice Basic

Article Id: WHEBN0000318131
Reproduction Date:

Title: OpenOffice Basic  
Author: World Heritage Encyclopedia
Language: English
Subject: OpenOffice, Visual Basic, Universal Network Objects, IBM Workplace, OpenDocument
Collection: Articles with Example Basic Code, Basic Programming Language Family, Openoffice
Publisher: World Heritage Encyclopedia
Publication
Date:
 

OpenOffice Basic

OpenOffice Basic (formerly known as StarOffice Basic or StarBasic or OOoBasic) is a dialect of the LibreOffice (where it is known as LibreOffice Basic).

Contents

  • Example 1
  • See also 2
  • Further reading 3
  • External links 4

Example

Although OpenOffice Basic itself is similar to other dialects of BASIC, such as Microsoft's VBA, the application programming interface (API) is very different, as the example below of a macro illustrates. While there is a much easier way to obtain the "paragraph count" document property, the example shows the fundamental methods for accessing each paragraph in a text document, sequentially.

Sub ParaCount
'
' Count number of paragraphs in a text document
'
    Dim Doc As Object, Enum As Object, TextEl 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
' Examine each component - paragraph or table?
    Enum = Doc.Text.CreateEnumeration
    While Enum.HasMoreElements
        TextEl = Enum.NextElement
' Is the component a paragraph?
        If TextEl.SupportsService("com.sun.star.text.Paragraph") Then
            Count = Count + 1
        End If
    Wend
'Display result
    MsgBox Count, 0, "Paragraph Count"
End Sub

See also

Further reading

  • Steinberg, James. Open Office Basic: An Introduction. CreateSpace Independent Publishing Platform.  

External links

BASIC Macros
  • OpenOffice.org BASIC Programming Guide wiki
  • OpenOffice.org VBA emulation model project (still in heavy development)
  • Andrew Pitonyak's macro information
OpenOffice.org API
  • OpenOffice.org/StarOffice API Project Page
    • OpenOffice.org SDK
    • OpenOffice.org Developer's Guide
    • API reference manual
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.