OpenOffice Basic

OpenOffice Basic (trước đây được gọi là StarOffice Basic hoặc StarBasic hoặc OOoBasic) là một phiên bản của ngôn ngữ lập trình BASIC ban đầu là một phần của bộ ứng dụng văn phòng StarOffice và sau này được đưa sang OpenOffice.org cũng như các phân nhánh của nó như LibreOffice (ở đây nó được gọi là LibreOffice Basic).

Ví dụ

Mặc dù OpenOffice Basic là một phiên bản tương tự như các phiên bản khác của ngôn ngữ BASIC,như VBA của Microsoft, giao diện lập trình ứng dụng(API) là rất khác, như ví dụ dưới đây của một macro minh họa. Trong khi có một cách dễ dàng hơn để có thể " đếm số đoạn văn" của một tài liệu, tví dụ cho thấy các phương pháp cơ bản để truy cập mỗi đoạn văn trong một tài liệu văn bản, liên tục.

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

Xem thêm

  • So sánh các bộ ứng dụng văn phòng

Đọc thêm

  • Steinberg, James (2012). Open Office Basic: An Introduction. CreateSpace Independent Publishing Platform. ISBN 978-1481270939.

Tham khảo

Liên kết ngoài

BASIC Macros
OpenOffice.org API

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.