ScriptForge-biblioteket

For å bruke denne funksjonen …

Åpne Verktøy - Makroer - LibreOffice Basic - Rediger og velg Programmakroer-kontainer.


ScriptForge-biblioteker bygger opp en utvidbar samling av makroskriptressurser for LibreOffice som kan startes fra grunnleggende makroer eller Python-skript.

note

• Grunnleggende makroer krever å laste ScriptForge-biblioteket ved hjelp av følgende setning:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Python-skript krever import fra scriptforge-modulen:
fra scriptforge import CreateScriptService


tip

For å lære mer om hvordan du oppretter og kjører Python-skript ved å bruke ScriptForge-biblioteket, les hjelpesiden Opprette Python-skript med ScriptForge.


Aktiverer ScriptForge-tjenester

De beskrevne modulene og klassene påkalles fra brukerskript som "Tjenester". En generisk konstruktør av disse tjenestene er designet for det formålet for hvert språk.

Metoden Kasser er tilgjengelig i alle tjenester og bør anropes for å frigjøre ressurser etter bruk:

I Basic

    GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
    Set oSvc = CreateScriptService("servicename"[, arg0, arg1, ...])
    ' ...
    oSvc.Dispose()
  
I Python

    from scriptforge import CreateScriptService
    svc = CreateScriptService('servicename'[, arg0, arg1, ...])
    # ...
    svc.Dispose()
  

Tjenester levert av ScriptForge-biblioteket

Kategori

Tjenester

LibreOffice Basic

Array
Dictionary

Exception
FileSystem

String
TextStream

Dokumentinnhold

Base
Calc

Chart
Database

Document
Writer

Brukergrensesnitt

Dialog
DialogControl
Form

FormControl
Menu

PopupMenu
UI

Verktøy

Basic
L10N
Platform

Region
Services
Session

Timer
UnitTest


ScriptForge.Matrise tjeneste

Gir en samling metoder for å manipulere og transformere matriser med én dimensjon (vektorer) og matriser med to dimensjoner (matriser). Dette inkluderer settoperasjoner, sortering, import fra og eksport til tekstfiler.

Matriser med mer enn to dimensjoner kan ikke brukes med metodene i denne tjenesten, det eneste unntaket er CountDims-metoden som godtar matriser med et hvilket som helst antall dimensjoner.

SFDocuments.Basis tjeneste

Tjenesten Base gir en rekke metoder og egenskaper for å forenkle administrasjon og håndtering av LibreOffice Base-dokumenter.

Denne tjenesten er nært knyttet til Dokument-tjenesten, som gir generiske metoder for håndtering av LibreOffice-dokumenter, inkludert basisdokumenter. Derfor utvider Base-tjenesten Dokument-tjenesten og gir ytterligere metoder som er spesifikke for basisdokumenter, slik at brukere kan:

ScriptForge.Grunnleggende tjeneste

Tjenesten ScriptForge.Basic foreslår en samling av LibreOffice Basic-metoder som skal utføres i en Python-kontekst. Grunnleggende tjenestemetoder gjengir den nøyaktige syntaksen og oppførselen til grunnleggende innebygde funksjoner.

SFDocuments.Calc tjeneste

Det delte biblioteket SFDocuments gir en rekke metoder og egenskaper for å forenkle administrasjon og håndtering av LibreOffice-dokumenter.

Tjenesten SFDocuments.Calc er en underklasse av SFDocuments.Document tjeneste. Alle metoder og egenskaper definert for Dokument-tjenesten kan også nås ved å bruke en Calc-tjenesteforekomst.

Tjenesten Calc er fokusert på:

SFDocuments.Chart service

The Chart service provides a set of properties and methods to handle charts in Calc documents. With this service it is possible to:

SFDatabases.Database service

The Database service provides access to databases either embedded or described in Base documents. This service provides methods to:

SFDialogs.Dialog service

The Dialog service contributes to the management of dialogs created with the Basic Dialog Editor. Each instance of the current class represents a single dialog box displayed to the user.

SFDialogs.DialogControl service

The DialogControl service manages the controls belonging to a dialog defined with the Basic Dialog Editor. Each instance of the current service represents a single control within a dialog box.

The focus is set on getting and setting the values displayed by the controls of the dialog box. Formatting is accessible via the XControlModel and XControlView properties.

Note that the unique DialogControl.Value property content varies according to the control type.

A special attention is given to controls of type tree control. It is easy to populate a tree, either branch by branch, or with a set of branches at once. Populating a tree control can be performed statically or dynamically.

ScriptForge.Dictionary service

A dictionary is a collection of key-item pairs

SFDocuments.Document service

The SFDocuments library provides methods and properties to facilitate the management and manipulation of LibreOffice documents.

Methods that are applicable for all types of documents (Text Documents, Sheets, Presentations, etc) are provided by the SFDocuments.Document service. Some examples are:

ScriptForge.Exception service

The Exception service is a collection of methods to assist in code debugging in Basic and Python scripts and in error handling in Basic scripts.

In Basic scripts, when a run-time error occurs, the methods and properties of the Exception service help identify the error context and allow to handle it.

ScriptForge.FileSystem service

The FileSystem service includes routines to handle files and folders. Next are some examples of the features provided by this service:

SFDocuments.Form service

The Form service provides methods and properties to manage forms in LibreOffice documents. This service supports forms in Base, Calc and Writer documents and allows to:

SFDocuments.FormControl service

The FormControl service provides access to the controls that belong to a form, a subform or a table control of a FormDocument. Each instance of the FormControl service refers to a single control in the form. This service allows users to:

ScriptForge.L10N service

This service provides a number of methods related to the translation of strings with minimal impact on the program's source code. The methods provided by the L10N service can be used mainly to:

SFWidgets.Menu service

The Menu service can be used to create and remove menus from the menubar of a LibreOffice document window. Each menu entry can be associated with a script or with a UNO command. This service provides the following capabilities:

ScriptForge.Platform service

The Platform service provides a collection of properties about the current execution environment and context, such as:

SFWidgets.PopupMenu service

The PopupMenu service can be used to create popup menus that can be associated with events or executed by scripts. This service provides the following capabilities:

ScriptForge.Region service

The Region service provides a collection of properties and methods to handle locale and region-related aspects of programming, such as:

ScriptForge.Services service

The main purpose of the Services module is to provide access to the CreateScriptService method, which can be called in user scripts to instantiate services that are implemented using the ScriptForge framework.

ScriptForge.Session service

The Session service gathers various general-purpose methods about:

ScriptForge.String service

The String service provides a collection of methods for string processing. These methods can be used to:

ScriptForge.TextStream service

The TextStream service is used to sequentially read from and write to files opened or created using the ScriptForge.FileSystem service.

The methods OpenTextFile and CreateTextFile from the FileSystem service return an instance of the TextStream service.

ScriptForge.Timer service

The Timer service measures the amount of time it takes to run user scripts.

A Timer measures durations. It can be:

ScriptForge.UI service

The UI (User Interface) service simplifies the identification and the manipulation of the different windows composing the whole LibreOffice application:

SFUnitTests.UnitTest service

The UnitTest service provides a framework for automating unit tests using the Basic language, including the ability to:

SFDocuments.Writer service

The SFDocuments shared library provides a number of methods and properties to facilitate the management and handling of LibreOffice documents.

Some methods are generic for all types of documents and are inherited from the SF_Document module, whereas other methods that are specific for Writer documents are defined in the SF_Writer module.

Merk: Andre ScriptForge ikke beskrevne moduler er reservert for intern bruk. Innholdet deres kan endres uten varsel.

warning

Alle ScriptForge Grunnleggende rutiner eller identifikatorer som er prefikset med et understrekingstegn "_" er reservert for intern bruk. De er ikke ment å brukes i grunnleggende makroer eller Python-skript.


Supporter oss!