OpenOffice Basic: Difference between revisions

Content deleted Content added
Cydebot (talk | contribs)
m Robot - Moving category OpenOffice.org to Category:OpenOffice per CFD at Wikipedia:Categories for discussion/Log/2012 December 24.
Chtfn (talk | contribs)
m External links: fix LibreOffice Basic Help link
 
(45 intermediate revisions by 28 users not shown)
Line 1:
{{Short description|Programming language}}
[[File:TriBasicExample.png|thumb|Three modern Basic variants: [[Mono (software)|Mono]] Basic, [[OpenOffice Basic]] and [[Gambas]].]]
{{no footnotes|date=December 2013}}
'''OpenOffice Basic''' (formerly known as StarOffice Basic or '''StarBasic''' or '''OOoBasic''') is a dialect of the [[programming language]] [[BASIC]] that is includedoriginated with the [[StarOffice]] [[Productivity software#Office suite|office suite]] and spread through [[OpenOffice.org]], and derivatives such as [[StarOfficeApache OpenOffice]] and [[LibreOffice]] (where it is known as '''LibreOffice Basic'''). The language is a [[office___domain-specific suiteprogramming language]]s which specifically serves the OpenOffice application suite.
 
== Example ==
Although OpenofficeOpenOffice Basic itself is similar to other dialects of BasicBASIC, such as [[Microsoft]]'s [[Visual Basic for Applications|VBA]] (VBA), the [[application programming interface]] (API) is very different, as the example below of a [[Macro (computer science)|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.
 
<syntaxhighlight lang="oobasvbnet">
<!--oobas = openoffice basic; see [[mw:Extension:SyntaxHighlight_GeSHi#Supported_languages]] -->
<syntaxhighlight lang="oobas">
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
</syntaxhighlight>
Line 35:
== See also ==
* [[Comparison of office suites]]
 
== Further reading ==
* {{Cite book|first=James|last=Steinberg|title=Open Office Basic: An Introduction|year=2012 |isbn=978-1481270939|publisher=CreateSpace Independent Publishing Platform}}
 
== External links ==
* [http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide OpenOffice.org BASIC Programming Guide] wiki
=== BASIC Macros ===
* [https://help.libreoffice.org/latest/en-US/text/sbasic/shared/main0601.html LibreOffice Basic Help]
*[http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide OpenOffice.org BASIC Programming Guide] wiki
* [https://www.manfridayit.co.uk/blog/coding-vba-tips-snippets/using-vb-net-to-update-open-office-calc-spreadsheet/ Automating Open Office in VB.NET]
*[http://wiki.services.openoffice.org/wiki/VBA OpenOffice.org VBA emulation model project] (still in heavy development)
*[http://www.pitonyak.org/oo.php Andrew Pitonyak's macro information]
 
=== {{OpenOffice.org API ===}}
*[http://api.openoffice.org/ OpenOffice.org/StarOffice API Project Page]
**[http://api.openoffice.org/SDK/index.html OpenOffice.org SDK]
**[http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide OpenOffice.org Developer's Guide]
**[http://api.openoffice.org/docs/common/ref/com/sun/star/module-ix.html API reference manual]
 
{{OpenOffice.org}}
{{BASIC}}
 
[[Category:Articles with example BASIC code]]
[[Category:BASIC programming language family]]
<!-- Overwriting the cat of the template OpenOffice with a sort key-->
[[Category:OpenOffice|Basic]]
[[Category:LibreOffice|Basic]]
 
{{programming-software-stub}}
 
[[de:StarOffice Basic]]
[[fr:StarOffice Basic]]