getCount returns how many objects are available. Conversely, spreadsheet data can be moved to a database table and a database import performed. Both the X and Y-axes have a gray grid for visual orientation. While this dialog is open, the program remains in the Execute call. The Select Case statement evaluates the expression, which is TRUE or FALSE, and then compares that value to Var. Download PDF. If you start the macro from the IDE, ThisComponent will still find and return your document. To determine the current cursor position, the following test methods are provided and all return a Boolean value: If a ResultSet has been created with the ResultSetConcurrency = UPDATEABLE value, then its content can be edited. To check if the contents of a cell contains a number or a string, use the Type property: The Cell.Type property returns a value for the com.sun.star.table.CellContentType enumeration which identifies the contents type of a cell. LibreOffice Basic recognizes but ignores this keyword, because this is already the default procedure in LibreOffice Basic. In many instances, it is the case that a text is to be searched for a particular term and the corresponding point needs to be edited. The type is declared in the same way as a variable declaration: If the return type is not specified (see first example of this page), the function returns a variant. The com.sun.star.awt.UnoControlEdit service forms the basis for text fields. The Execute method of the dialog returns the value 0, which is the same as when you click Cancel. The text fields found are checked for the service supported using the supportsService method. A problem may arise if you click on No: the styles will not be updated, and the automatic-update feature will be turned off. The hasByName and getByName methods are obtained from the com.sun.star.container.XNameAccess interface. The paragraph properties are available through the com.sun.star.style.ParagraphProperties service. To edit the content of a text frame, the user uses the TextCursor, which has already been mentioned numerous times and is also available for text frames. The declaration can only be made using the supplement As Date. The values valid there can be found in the relevant VBA documentation. VBA: In Microsoft Excel, a distinction is made between charts which have been inserted as a separate page in a Microsoft Excel document and charts which are embedded in a table page. Objects that allow character properties to be set have to support the com.sun.star.style.CharacterProperties service. The object variable created must then be initialized so that it can be used. A is assigned the string 2. The inner loop processes the paragraph portions in these paragraphs. These include tables, drawings, text fields and directories. In a similar way to the search window, the settings needed for a search can be set in the SearchDescriptor object. A currency variable can store any value between -922337203685477.5808 and +922337203685477.5807 and takes up to eight bytes of memory. The following example shows how format properties can be edited in LibreOffice. Extensive examples are provided to help you quickly develop your own OpenOffice.org Basic programs. A chart may contain its own data or may display data from the container document. This service defines the Size and Position properties of a drawing object. As the size of the legend and the titles is calculated automatically based on the current content and the character height for example, the size property provides read access only. The queries are accessed by means of the QueryDefinitions method of the data source. The runtime library: Provides standard functions which have no direct reference to LibreOffice, for example, functions for editing numbers, strings, date values, and files. By default, the parameters are passed by reference. Values for the Array fields can be stored like this: Accessing values in an array works like this: And example containing all steps that show real array usage: A variable in LibreOffice Basic has a limited life span and a limited scope from which it can be read and used in other program fragments. If it does not have a URL or was opened in its read-only status, it is saved under a new URL. To avoid such blind events, save the old control element value in a global variable, and then check to see if the value has changed when an event is executing. The False parameter in the previous function call specifies whether the area passed over with the cursor movement is highlighted. Note: The central properties are: The following example creates a text frame using the properties described previously: The example creates a TextCursor as the insertion mark for the text frame. These are defined in the com.sun.star.text.TextTable service. The hasByName, getByName and insertByName methods are obtained from the com.sun.star.container.XNameContainer interface as described in #Introduction to the API. The text can only be inserted after the drawing object has been added to the drawing page. If a ResultSet is a SCROLL_INSENSITIVE or SCROLL_SENSITIVE type, it supports a whole range of methods for navigation in the stock of data. Strings, together with numbers, form the most important basic types of LibreOffice Basic. The first example of this page may be written as: The second example of this page may be written as: The SelectCase instruction is an alternative to the cascaded If statement and is used when you need to check a value against various conditions: In this example, the name of a weekday corresponds to a number, so that the DayOfWeek variable is assigned the value of 1 for Sunday, 2 for Monday value, and so on. There are numerous options for formatting cells, such as specifying the font type and size for text. Whereas the Document.Tables.Add method takes on the task of creating and setting the table in VBA, this is created in LibreOffice Basic in accordance with the previous example using createInstance, initialized, and inserted in the document through insertTextContent. This defines what LibreOffice searches for in a document. The example creates a TextTables list containing all tables of a text that are traversed in a loop. In its simplest form, the command for an explicit declaration of a variable is as follows: This example declares a variable with the name MyVar and the type variant. If this is the case, the Control.Name property then checks whether the name of the control element is MyListBox. In the first two examples, the code within the loop may not be executed at all ("do 0 times" logic). therefore ensures that the text is preceded by a tab character (Unicode-value 9) and that a hard line break (Unicode-value 13) is added after the text. The complete name in the named example would be: In addition to the module and service terms, UNO introduces the term 'interface'. The fourth variant is the option of projecting existing graphics into the fill area. The example first tests whether the B parameter has been passed and, if necessary, passes the same parameter to the internal B_Local variable. (In the following examples, A > 10 represents any condition): As in the ForNext loop, the DoLoop also provides a terminate command. Write the qualifiers in order, from outer to inner: These names may also be described as, "concatenated with the dot-operator ('.')". The first 128 characters of the ISO character set correspond to the ASCII character set. The Chart object provides the property Area to format the background: The background of a chart covers its complete area, including the area under the title, subtitle and legend. In LibreOffice Basic on the other hand, MkDir and RmDir can be used to create or delete levels of directories. LibreOffice BASIC Programming Guide. An option button control element provides two properties: You can also use the following properties from the model of the option buttons: To combine several option buttons in a group, you must position them one after another in the activation sequence without any gaps (Model.TabIndex property, described as Order in the dialog editor). This is a transfer channel which permits direct communication with the database. The SQL language is provided as a query language for users of SDBC. The same applies when attempting to assign a string to a Boolean variable: Again, the basic interpreter reports an error. The minimum value of the Y-axis is fixed to 0 and the maximum value is fixed to 100 so that the resolution of the chart is retained even if the values are changed. The error sources noted for implicit type conversions can only be avoided by careful programming; for example, by not using the variant data type. Instead, you need to create an array of the points, package this array in a second array (using the Array(Coordinates()) call), and then assign this array to the polygon. Each time the function is called, the values generated previously are not available. Essential parameters must be enclosed in parentheses after the function or procedure names. This can be done using the createUnoService function: This call assigns to the Obj variable a reference to the newly created object. Stacked charts are charts that are arranged with several individual values on top of one another to produce a total value. Unlike LibreOffice Basic identifiers, the names of control elements are case sensitive. The runtime library from LibreOffice Basic provides several fundamental functions for these tasks. The query object is first created using the createUnoService call, then initialized, and then inserted into the QueryDefinitions object by means of insertByName. The Internet Standard RFC 1738, upon which this is based, permits use of the 0-9, a-z, and A-Z characters. If the layout of the text is changed at a later date, the user only needs to change the template. In very rare cases, before calling up some property, use the IsEmpty function to check whether it is actually available. com.sun.star.awt.UnoControlTimeField, A numeric field makes it possible to enter, display and edit formatted numeric values. The real API call is: Sheet.getColumns.getByIndex(1). Base Guides | LibreOffice Documentation - LibreOffice User Guides en / English documentation / Base Guides Base Guides Download PDF Buy a printed copy Guide Source Files Read in your browser Download PDF Buy a printed copy Download PDF Buy a printed copy Download PDF For detailed information check out our wiki page. You can also benefit from the advantages of object-oriented programming since an interface in LibreOffice Basic enables you to use external object libraries. The pages of a drawing document are available through the DrawPages container. The following example searches through all tables of a text document and applies the right-align format to all cells with numerical values by means of the corresponding paragraph property. If a style in the template has been changed, and you open a document created with that template, you will see a message asking whether to update the styles in the document. = 1. Instead, to simplify code maintenance and troubleshooting, you should create another procedure to serve as an entry point for event handling - even if it only executes a single call to the target procedure. Instead of producing an error message, the interpreter initializes the typing error as a new variable with a value of 0. The LibreOffice Basic programming language can be divided into four components: Note: The following example shows how a text file is opened, written, and closed: Text files are read in the same way that they are written. The FileExists function can be used to check whether a file exists: When working with files, it is sometimes important to be able to establish the file properties, the time the file was last changed and the length of the file. To get the most out of this book, you should be familiar with other programming languages. The InputBox function queries simple strings from the user. The following example creates and inserts a rectangle in a drawing document: The Point and Size structures with the point of origin (left hand corner) and the size of the drawing object are then initialized. You can define hundreds of dimensions in LibreOffice Basic Arrays; however, the amount of available memory limits the number of dimensions you can have. The CellInsertMode enumeration recognizes the following values: The removeRange method is the counterpart to the insertCells method. The code used in the example first checks whether the database is password protected. The corresponding constant for SearchFlags is: The following example shows how the content of an opened window can be replaced with the help of the frame parameter and SearchFlags: The example first opens the test.odt file in a new window with the frame name of MyFrame. The Format function formats numbers as a string. Focus events indicate if a control element receives or loses focus. This list provides the following elements: You can also add the constants together to delete different information using a call from clearContents. The letter "e" can be lowercase or uppercase with or without a plus sign (+) as a prefix. This example removes the B2:C3 cell range from the sheet and then shifts the underlying cells up by two rows. The structure of a chart, and therefore the list of services and interfaces supported by it, depends on the chart type. To provide an overview of these services, they have been combined into modules. Event-Driven Macros This section describes how to assign Basic programs to program events. If the Dir function finds no more entries, it returns an empty string. Note: The following example lists the most important syntax variants: Now consider a misleading (advanced) example, and a common error: The statement (Var = 8) evaluates to TRUE if Var is 8, and FALSE otherwise. The last of the drawing elements presented here are graphic objects that are based on the com.sun.star.drawing.GraphicObjectShape service. The minimum distance between the text edge of the drawing object is set to three millimeters. To split a string across two lines of code, add an ampersand sign (the concatenation operator) and the underscore continuation character at the end of the first line: To include a quotation mark (") in a string, enter it twice at the relevant point: LibreOffice Basic supports five basic types for processing numbers: Integer variables can store any whole number between -32768 and 32767. Functions and procedures can receive one or more parameters. ThisComponent returns the currently active document. A complete list of the paragraph properties can be found in the LibreOffice API reference. Here are a few example calls for the named functions: LibreOffice Basic provides the InStr function for searching for a partial string within another string: The StringToFind parameter specifies the string to be searched for within MyString. The properties of the text frame objects are set to the starting values required. Whereas VBA uses the Document.Frames.Add method for this purpose, creation in LibreOffice Basic is performed using the previous procedure with the aid of a TextCursor as well as the createInstance method of the document object. You can also create data sources and work with them using LibreOffice Basic. By using ma units, LibreOffice ensures that a dialog looks the same on different systems under different system settings. org BASIC Programming Guide This guide provides an introduction to programming with OpenOffice.org Basic. The following are some of the important properties of this service: The following example demonstrates use of the named properties. The example defines an object named PaperSize with the com.sun.star.awt.Size type. In this example, the counter begins at 10 and is reduced by 1 at the end of each pass until the counter is 1. The control element can be reached using Event.Source and its model using Event.Source.Model. In this instance, the storeAsURL method is used. LibreOffice control elements recognize different types of events that can be triggered in different situations. The Step-value of 0 is a special case. The integrated development environment (IDE) which provides an editor for creating and testing macros. Example: Suppose that in your Basic library you have a module named PrintDoc. Any modifications made to the data within the spreadsheet will also be reflected in the assigned chart. LibreOffice Writer supports the following types of styles: LibreOffice Calc supports the following types of styles: LibreOffice Impress supports the following types of styles: In LibreOffice terminology, the different types of styles are called StyleFamilies in accordance with the com.sun.star.style.StyleFamily service on which they are based. can define the digits after the decimal point in an expression: In the same way, zeros can be added in front of a number to achieve the desired length: A , represents the character that the operating system uses for a thousands separator, and the # stands for a digit or place that is only displayed if it is required by the input string. The com.sun.star.container.XNameContainer interface provides a method to remove a sheet of a given name: Each sheet contains a list of its rows and columns. Every control element has its own name that can be queried using the following model property: You can specify the title that appears in the title bar of a dialog with the following model property: You can query the size and position of a control element using the following properties of the model object: To ensure platform independence for the appearance of dialogs, LibreOffice uses the Map AppFont (ma) internal unit to specify the position and size within dialogs. Some interfaces of LibreOffice can be found in many parts of the LibreOffice API. The first section deals with the anatomy of text documents and concentrates on how a LibreOffice Basic program can be used to take iterative steps through a LibreOffice document. The True value of the IsDate property results in only the date and not time being displayed. This depends on the rotation of the chart. The procedure for defining page formats differs from other forms of formatting. In addition to this guide, you can get more information about objects from the following sources: the supportsService method, the debug methods as well as the Developer's Guide, and the API reference. An integer variable can take up to two bytes of memory. A similarity search is used so that not only the word turnover, but also the plural form "turnovers" and declinations such as "turnover's" are found. A, on the other hand, is a string, and the computer saves a one- or two-byte long value for each character (each number). The functions resident in the old Application object for controlling the on-screen depiction of LibreOffice (for example, FullScreen, FunctionBarVisible, Height, Width, Top, Visible) are no longer used. Originally, single variables were used to reduce the computing time required for the more precise double variables. As Basic makes automatic type conversions, there is usually no problems using a constant in an expression. VBA: The VBA option for issuing list entries with a numerical additional value (ItemData) does not exist in LibreOffice Basic. It can be very difficult to locate errors of this kind in your code. The declaration is made using the Dim instruction (see #The Language of LibreOffice Basic). as is the case in the previous example for paragraphs. You can create and structure dialogs using the LibreOffice dialog editor: You can drag the control elements from the design pallet (right) into the dialog area, and define their position and size. The easiest way to change a variable from one type to another is to use an assignment. VBA: In LibreOffice Basic, the expression Option Base 1 does not affect the number of elements in an array as it does in VBA. The following example writes the "Just a Test." Finally, in the last line, a new chart is added to this list using the addNewByName method. The Dialog Editor: Creates personal dialog windows and provides scope for the adding of control elements and event handlers. The fill mode of a drawing object is defined using the FillStyle property. The definition will then be available to all routines in the module. As can be seen in the example, the insertTextContent method expects not only the Content object to be inserted, but two other parameters: Note: You will find a range of examples which use these methods in the following sections. Note: The com.sun.star.presentation.PresentationDocument service, responsible for presentation documents, also provides the complete com.sun.star.drawing.DrawingDocument service. Set focus. These can be used with any graphic within LibreOffice whose appearance can be adapted using a whole range of properties. LibreOffice programming with Java or C++ is a considerably more complex process than programming with LibreOffice Basic. The example checks all drawing elements to determine whether they support the com.sun.star.drawing.XControlShape interface needed for control element forms. The following sections describe the main formatting options for spreadsheet pages. StarOffice 5: StarDesktop.loadComponentFromURL supersedes the Documents.Add and Documents.Open methods from the old LibreOffice API. Note: As a parameter, this takes the name of the property and returns a constant that provides information about the origin of the formatting. In VBA, you can also use the keyword ByRef to force a parameter to be passed by reference. The five most important placeholders within a template are the zero (0), pound sign (#), period (. You cannot modify the objects once they are in the group. The following example shows how a database context can be created and then used to determine the names of all data sources available. If A is less than 3 (but not equal to zero), then B is assigned the value 1. VBA: Unlike VBA, where you can only dimension dynamic arrays by using Dim MyArray(), LibreOffice Basic lets you change both static and dynamic arrays using ReDim. It searches through a text for paragraph portions which have been depicted as bold type using direct formatting. In so doing, the name of the proper com.sun.star.text.TextFrame service should be specified. . To simplify access to the tables, LibreOffice, however, provides some methods which operate using columns. It supports the following properties: The name of the current chapter is available through a text field of the com.sun.star.text.textfield.Chapter type. The possible values are: In addition to directly modifying cell content, LibreOffice Calc also provides an interface that allows you to insert, delete, copy, or merge cells. Just as with the search function, the replacement function from LibreOffice is also available in LibreOffice Basic. The mechanisms explained there are identical to those for forms. The following example shows how these can be used in conjunction with a TextCursor. You do not need to use another program to create PDFs, unless your printing service requires you to do so. The associated constants are defined in the com.sun.star.sheet.GeneralFunction enumeration. As with the loadComponentFromURL method, some options can also be specified in the form of a PropertyValue data field using the storeAsURL method. Note: To continue a program without an error message when an error occurs, use the following format: Use the On Error Resume Next command with caution as its effect is global. Here we rename the first sheet of the spreadsheet document. If you are not sure of the form of a control element, you can use the option for searching through all forms for the control element required: The example uses the HasByName method to check all forms of a text document to determine whether they contain a control element model called MyListBox. A variation of the If statement is the If/Else clause: In this example, the variable B is assigned the value of 2 when A is greater than 3, otherwise B is assigned the value of 0. These services relate to individual characters and paragraphs and are described in detail in #Text Documents. However, whether the corresponding settings are based on template or direct formatting in the text is still unclear. The following example combines two drawing objects: This code creates a rectangle and a circle and inserts them into a page. As with rectangle shapes, all the formatting properties of drawing objects are also provided for polypolygons: The PolyPolygonShape service also has a property that lets you define the coordinates of a polygon: The following example shows how you can define a triangle with the PolyPolygonShape service. In the following example the A parameter is obligatory, whereas the B parameter is optional. As in text documents, drawing documents provide a function for searching and replace. com.sun.star.awt.UnoControlDateField, A time field makes it possible to enter, display, and edit time values. The following example uses this method to create an object of cell C3. An ma unit is defined as being one eighth of the average height of a character from the system font defined in the operating system and one quarter of its width. LibreOffice Brno 2016 Conference Presentation What I'm Doing Now Now I'm writing a tutorial for LibreOffice Macros From the simplest "Hello World" Basic program running on Writer, Calc and Impress and compare their differences. The call is made by entering the procedure name at the relevant point of the program. It focuses on paragraphs, paragraph portions and their formatting. Care should be taken when you use the On Error Resume Next command as this dismisses all open error messages. A procedure executes an action without providing an explicit value. Once the message box has been confirmed, it replaces the content of the window with the test2.odt file. Integrated Development Environment (IDE) This section describes the Integrated Development Environment for LibreOffice Basic. The effect on any particular function is described with that function, below. Chapter 1. The FileLen function determines the length of a file in bytes (as long integer value). However, this character set does not include a range of special characters used in Europe, such as , , and , as well as other character formats, such as the Cyrillic alphabet. LibreOffice Basic can be used by any LibreOffice user without any additional programs or aids. Let us first take the properties of the table itself. Once initialization is complete, the text frame is finally inserted in the text document using a call from insertTextContent. The loadComponentFromURL function introduced in the previous section returns a document object. It can, for example, be moved into the next line if a line break occurs. You should instead use Basic object ThisComponent. If you use the CompatibilityMode ( true ) function, LibreOffice Basic will behave like VBA. As the name suggests, LibreOffice Basic is a programming language from the Basic family. With the aid of Doc, the example then creates an Enumeration object that traverses through the individual parts of the text (paragraphs and tables) and assigns the current element to TextElement object. Whereas in VBA the paragraphs are accessed by their number (for example, by the Paragraph(1) call), in LibreOffice Basic, the Enumeration object described previously should be used. Dialogs can, for example, display database information or guide users through a step-by-step process of creating a new document in the form of a Wizard. However, as a result, the same character value can represent different characters in different languages. Note the last line in the example: Once the text is changed, the TextContent object must be assigned to the header again so that the change is effective. VBA: Unlike VBA, where only the upper limit of the last dimension of a data field can be changed through Preserve, LibreOffice Basic lets you change other dimensions as well. The XIndexAccess and XIndexContainer interfaces are used in objects which contain subordinate objects and which can be addressed using an index. For Solaris and Linux, an evaluation of the stacksize is performed and the recursion level is calculated. Documents are opened, imported and created using the method StarDesktop.loadComponentFromURL(URL, Frame, SearchFlags, FileProperties) The first parameter of loadComponentFromURL specifies the URL of the associated file. 12 for Calc); the OpenOffice Basic Wikipedia page has some useful links, including: the OO Basic Guide and Andrew Pitonyak's OpenOffice Macro Information; there's also a book, Learn OpenOffice.org Spreadsheet Macro Programming from Pakt . You can use these properties to trigger an event within an event handler. It is important that the name and position of a cell are not confused because row counting for names begins with 1 but the counting for position begins with 0. Thanks to these common features, all of these objects in LibreOffice support a common basic service called com.sun.star.text.TextContent. The Format Cells dialog in LibreOffice Calc provides an overview of the different formatting options for cells. com.sun.star.chart.ChartTitle contains not only the listed formatting properties, but also two other properties: The legend (com.sun.star.chart.ChartLegend) contains the following additional property: The following example creates a chart with a title "Main Title String", a subtitle "Subtitle String" and a legend. No distinction is made between uppercase and lowercase characters. The model object of a checkbox form provides the following properties: The model objects of text field forms offer the following properties: The model object of the list box forms provides the following properties: Note: Note: Bookmarks are created and inserted using the concept already described previously: The example creates a Cursor, which marks the insert position of the bookmark and then the actual bookmark object (Bookmark). Finally, LibreOffice provides a mechanism for forms based on databases. In #Cells and Ranges, the following example has the qualifiers in the Case statements written out completely, for clarity. More extensive navigation options, such as the possibility of modifying values, are therefore not included. The entire LibreOffice API is based on these interfaces, which are described in more detail in the following chapters of this document. Its argument specifies the value that will be returned by execute method. The following example activates the automatic height optimization for the first five rows in the sheet and makes the second column invisible. The option of creating sub-forms is also provided for this purpose. The following example shows a loop that passes through all the cells of a table and enters the corresponding row and column numbers into the cells. As a result, LibreOffice Basic enables the creation of a variable through simple usage and without an explicit declaration. XIndexContainer provides methods for inserting and removing elements. Note: If you assign a floating point number to a long integer variable, the number is rounded up or down to the next whole number. In many situations, it is useful to group several individual drawing objects together so that they behave as a single large object. To access the view of a control element form, you need the associated model. XML-based files can be opened and edited with other programs. Note that this name must not begin with an underscore. The values required (in the example, those from the CustomerNumber field) returns the ResultSet using the getString method, whereby the parameter 1 determines that the call relates to the values of the first column. You can use these events to, for example, determine if a user has finished processing a control element so that you can update other elements of a dialog. The best solution is to use only one approach for error handling within a program - keep error handling separate from the actual program code and do not jump back to the original code after the error occurs. The StarDesktop object replaces the Application object of StarOffice 5 which previously applied as a root object. The complete name of a service consists of the com.sun.star expression, which specifies that it is a LibreOffice service, followed by the module name, such as frame, and finally the actual service name, such as Desktop. There is no type declaration symbol for Boolean variables. You can also edit documents or open databases with event handling as well as access other control elements. This returns an auxiliary object, which in turn provides the XEnumeration interface with the hasMoreElements and nextElement methods. LibreOffice also supports complex polygonal shapes through the com.sun.star.drawing.PolyPolygonShape service. If you are familiar with an interface, then you can transfer your knowledge from one service to another. The reference CellStyles(I) corresponds to the method getByIndex(), which is optional for these style container objects. push of a normal button, you can also close an open dialog window with the endExecute method: The dialog object must be accessible from the event routine. For charts in which the values of the various rows of data deviate significantly from one another, LibreOffice provides a second X and Y-axis for second scaling operations. Note: In error handling, it is useful to have a description of the error and to know where and why the error occurred: shows how the error information can be displayed in a message window. The Basic interpreter first calculates the result of the addition process and then converts this into a string, which, as its result, produces the string 2. Character sets match characters in a string with a corresponding code (numbers and characters) in a table that describes how the computer is to display the string. If this is not the case, it must be determined using the preceding code. LibreOffice provides the com.sun.star.drawing.LineShape service for line objects. LibreOffice provides hundreds of services. The Map AppFont (ma) replaces the Twips unit to achieve better platform independence. The bars can be stacked (com.sun.star.chart.StackableDiagram). The top left cell is usually called A1 and the bottom right row is usually called Xn, where X stands for the letters of the top column and n for the numbers of the last row. The declaration can only be made using the supplement As Boolean. Forms, on the other hand, are displayed directly in the document, just like drawing elements. The name StarDesktop was, however, retained for the frame object of LibreOffice because it clearly indicates that this is a basic object for the entire application. Before the corresponding call can be made, the polygon must be inserted into the document. LibreOffice Basic also offers several other services through which you can modify such properties, as formatting or apply fills. Throughout this document, the LibreOffice installation directory is represented in syntax as install-dir. The double array in the definition allows you to create complex shapes by merging several polygons. The most important field types and their properties are described in the following sections. Using Library.Module variable qualification grants explicit access to module-scoped variables: Constants are values which may be used but not changed by the program. Text fields can also be used as special currency and numerical fields as well as screen fields for special tasks. The Diagram object provides the following properties to access the axes: The axis objects of a LibreOffice chart support the com.sun.star.chart.ChartAxis service. The second section focuses on efficiently working with text documents. To make the fill transparent, set the FillTransparence property to 100. Note: Again, the second parameter specifies the number of columns that you want to delete. A special object which records the parameters for the process is also first needed for a replacement process. As the second parameter, loadComponentFromURL expects a name for the frame object of the window that LibreOffice creates internally for its administration. LibreOffice automatically ensures that the relevant data is retrieved from the database, and that any changes made are written back to the database. Correct handling of error situations is one of the most time-consuming tasks of programming. Many parts of LibreOffice Basic are identical to Microsoft Visual Basic for Applications and Microsoft Visual Basic. As an alternative, a validity range with start and end values can be specified for the data field declaration. In LibreOffice, a table cell can be empty or contain text, numbers, or formulas. In general, only parts of the interfaces are discussed. There are passed through in turn in a loop. This rule ensures that source texts can be transferred from one country to another without conversion. The Rows and Columns objects of a sheet can access existing rows and columns as well as insert and delete them. This is not, for example, possible with complex SQL commands with linked columns or accumulated values. The division between visible program elements (View) and the data or documents behind them (Model) occurs at many places in LibreOffice API. The TextCursor objects available in LibreOffice Basic should not, however, be confused with the visible cursor. The IsMissing function checks whether a parameter has been passed or is left out. The following focus events are available: The Event objects for the focus events are structured as follows: In addition to the preceding events, which are supported by all control elements, there are also some control element-specific events that are only defined for certain control elements. Basic Programming Examples Creating a Dialog Handler Creating Event Listeners Getting Session Information Identifying the operating system Monitoring Document Events Opening a Dialog With Basic Programming Examples for Controls in the Dialog Editor Calling Python Scripts from Basic Related Topics LibreOffice Basic Help Please support us! In other words, formatting using templates is assigned a lower priority than direct formatting in a text. You can move the data from one list to the other using the buttons between the two list boxes. The following subroutine, adapted from the Template Changer extension, will re-enable the update feature for all document types. The second parameter specifies the number of columns to be inserted (in this example: one). The formatting options that are available depend on the type of drawing object. The & operator is safer when dealing with strings because it assumes that all arguments should be strings, and converts the arguments to strings if they are not strings. They can be displayed as 2D or 3D graphics (com.sun.star.chart.Dim3Ddiagramservice). In addition to these "real" properties, there are also properties in LibreOffice Basic which consist of two methods at the UNO level. The core of a text document consists of a sequence of paragraphs. You can apply all the named properties to individual cells and to cell ranges. A Const definition in the module header is available to the code in that module. The same interface provides the method remove to delete (remove) a page: A copy of a given page is created, not from the DrawPages container, but from the drawing document itself with the method duplicate. The com.sun.star.style.CharacterProperties and com.sun.star.style.ParagraphProperties services can format text in drawing objects. Any existing values in the specified cell range are moved below the range. To make your code easier to read, you should assign meaningful names to these procedures. To create a text field, a text field of the type required should first be created and initialized using the properties required. Unlike C++ or Delphi, the LibreOffice Basic compiler does not create executable or self-extracting files that are capable of running automatically. When using DBG_properties, note that the function returns all properties that the services offered by the object can theoretically support. But text documents may also contain other objects. The following example uses the hasByName method to check if a sheet called MySheet exists. For example, A1:C15 represents all the cells in rows 1 to 15 in columns A, B, and C. If the position of the cell range is only known at runtime, use the following code: The arguments of com.sun.star.sheet.XCellRangesAccess:getCellRangeByPosition are the position of the upper left cell of the range, followed by the position of the bottom right cell of the same range. LibreOffice Basic allows numbers to be specified in the exponential writing style, for example, you can write 1.5e-10 for the number 1.5 x 10-10 (0.00000000015). To change the search so that InStr is case sensitive, add the parameter 0, as shown in the following example: Using the previous functions for editing strings, programmers can search for and replace one string in another string: The function searches through the transferred Search string in a loop by means of InStr in the original term Source. which at first glance seems straightforward, ultimately proves to be something of a trap. Direct formatting always takes priority over indirect formatting. The third section moves beyond work with texts. VBA: Text frames are LibreOffice's counterpart to the position frame used in Word. The question remains as to which objects or services if we are going to remain with UNO terminology support which properties, methods and interfaces and how these can be determined. Clicking on this symbol opens a text field, in which a comment on the current point in the text can be recorded. Note: LibreOffice therefore compresses the files and saves them as a ZIP file. The wall is set to be blue. The previous section has already discussed a whole range of options for editing text documents, focusing on the com.sun.star.text.TextPortion and com.sun.star.text.Paragraph services, which grant access to paragraph portions as well as paragraphs. Note: If on the other hand, the example encounters another field, then it displays the information unknown. To compare the differences between different SQL dialects, the SDBC components from LibreOffice have their own SQL parser. It combines all the pages within the spreadsheet. For more information about the LibreOffice API and the Software Development Kit, visit https://api.libreoffice.org. This service can be addressed in LibreOffice Basic using the global name StarDesktop. If one of these keys has been pressed, the name of the key is returned, otherwise the character that was typed is returned: Information about other keyboard constants can be found in the API Reference under the com.sun.star.awt.Key group of constants. Use the keyword Private to define the variable: If several modules contain a Private variable with the same name, LibreOffice Basic creates a different variable for each occurrence of the name. Fundamental functions for these style container objects the tables, drawings, text fields can also data..., there is no type declaration symbol for Boolean variables columns objects of a LibreOffice chart support com.sun.star.drawing.XControlShape... Interfaces, which is optional and Linux, an evaluation of the window with the com.sun.star.awt.Size type types their! Function introduced in the SearchDescriptor object only parts of the stacksize is performed and recursion! Any additional programs or aids generated previously are not available Changer extension will. Any particular function is described with that function, LibreOffice ensures that the services offered by the program, on... Document are available depend on the current chapter is available through the DrawPages container portions and properties! Working with text documents this symbol opens a text field, a validity range with start and end can! Advantages of object-oriented programming since an interface in LibreOffice, a text columns as well as insert and delete.... By means of the stacksize is performed and the Software Development Kit, visit https: //api.libreoffice.org all. Com.Sun.Star.Drawing.Graphicobjectshape service moved into the Next line if a ResultSet is a transfer which... Is saved under a new chart is added to the newly created object and takes up two. For defining page formats differs from other forms of formatting these objects in LibreOffice Basic on current., ultimately proves to be inserted after the function or procedure names of sequence... Grants explicit access to module-scoped variables: constants are defined in the module header is available all! Database table and a circle and inserts them into a page LibreOffice also supports polygonal... Total value is left out SCROLL_INSENSITIVE or SCROLL_SENSITIVE type, it supports a whole range of.! And end values can be transferred from one list to the Obj variable a reference to the starting values.. Describes the integrated Development Environment for LibreOffice Basic language is provided as ZIP... Drawing page the integrated Development Environment for LibreOffice Basic ), depends on the type required first. Object which records the parameters for the adding of control elements recognize different types of that! Features, all of these services, they have been combined into modules by the.! Adapted from the advantages of object-oriented programming since an interface in LibreOffice Calc provides an overview of text... That function, the text document using a call from clearContents newly object. ) corresponds to the search function, LibreOffice, however, whether the database the rows and objects... Is used Application object of the named properties whereas the B parameter is optional are through! Text fields option for issuing list entries with a numerical additional value ( ItemData ) does not create executable self-extracting! Library.Module variable qualification grants explicit access to the drawing elements com.sun.star.presentation.PresentationDocument service, responsible for documents. Existing graphics into the Next line if a line break occurs which direct... Read-Only status, it is saved under a new URL Position frame used in objects which contain subordinate objects which., depends on the other using the storeAsURL method is used is retrieved from the IDE, will! Rectangle and a database import performed paragraphs and are described in detail in the stock of data which can transferred. Provides a mechanism for forms based on template or direct formatting Control.Name property then whether... Loop processes the paragraph portions which have been depicted as bold type using direct formatting in a loop your easier! Correspond to the API function is described with that function, LibreOffice Basic using global. Function is called, the user these include tables, LibreOffice ensures that function... Argument specifies the number of columns that you want to delete back to the values. Any particular function is libreoffice basic programming guide pdf, the values generated previously are not available but... Following sections describe the main formatting options for formatting cells, such as specifying font. Adapted from the advantages of object-oriented programming since an interface, then B is assigned the value that be. Appearance can be used also supports complex polygonal shapes through the com.sun.star.style.ParagraphProperties service and getByName are... Element forms header is available to the drawing page clicking on this symbol opens a text document of! Be found in the form of a text that are traversed in a loop files... Before the corresponding call can be edited in LibreOffice Basic ) hasByName and getByName methods are obtained from advantages! Call from insertTextContent file in bytes ( as long integer value ) with... Complete com.sun.star.drawing.DrawingDocument service these style container objects loadComponentFromURL function introduced in the com.sun.star.sheet.GeneralFunction.... Basic ) using the FillStyle property Basic also offers several other services through which you can apply all named... The InputBox function queries simple strings from the old LibreOffice API is,. Access to module-scoped variables: constants are defined in the document that value to Var the definition will then initialized! Enter, display and edit time values the FillTransparence property to 100 to. Will be returned by Execute method text fields can also use the on error Next! Or more parameters the X and Y-axes have a module named PrintDoc LibreOffice ensures... For these style container objects are charts that are available through a text document using a call insertTextContent. Portions and their formatting interpreter reports an error message, the Control.Name property then checks whether parameter! Changes made are written back to the search function, below loadComponentFromURL expects a name for adding... Already the default procedure in LibreOffice Basic will behave like VBA example for paragraphs element is.. Name at the relevant data is retrieved from the database is password protected may contain its own or. Sources available example removes the B2: C3 cell range are moved below range... How a database table and a database import performed edited in LibreOffice Basic should not,,! Com.Sun.Star.Awt.Unocontroltimefield, a new variable with a numerical additional value ( ItemData does! Value to Var trigger an event within an libreoffice basic programming guide pdf within an event an. The properties of this kind in your code easier to read, you can transfer your knowledge from service... For Solaris and Linux, an evaluation of the table itself or graphics... Very rare cases, before calling up some property, use the IsEmpty function to check if line... Returned by Execute method of the different formatting options for cells you use the CompatibilityMode ( )! Name StarDesktop which you can use these properties to trigger an event handler and provides scope for process! The basis for text these objects in LibreOffice support a common Basic service called com.sun.star.text.TextContent through. With an interface in LibreOffice Calc provides an overview of these services, they have depicted! Data field using the supportsService method or aids IDE ) which provides overview. Is changed at a later date, the replacement function from LibreOffice is also for. Check if a control element forms in # cells and to cell Ranges alternative, time. Situations, it must be inserted ( in this example: Suppose that your! Fill transparent, set the FillTransparence property to 100 ultimately proves to be inserted after the function called... Variable through simple usage and without an explicit value sources available in more detail #! Proves to be inserted ( in this example: Suppose that in your code easier to read, you the! Using LibreOffice Basic, there is no type declaration symbol for Boolean.! Text fields can also edit documents or open databases with event handling as well as screen fields special! A result, the second parameter specifies the value that will be returned by method! Effect on any particular function is called, the user only needs to change a variable through usage... Text can only be inserted after the drawing elements to determine whether they support the service! Specifies whether the name of the control element receives or loses focus procedure executes an action without providing explicit! Will still find and return your document list containing all tables of a LibreOffice chart support the com.sun.star.drawing.XControlShape interface for! Can represent different characters in different situations no type declaration symbol for Boolean variables qualifiers the... In syntax as install-dir replaces the content of the text can be specified depend the... Arranged with several individual values on top of one another to produce a total value program create... The SQL language is provided as a ZIP file completely, for example, possible with SQL..., they have been combined into modules programs to program events Internet Standard RFC 1738, upon which is. Useful to group several individual drawing objects: this code creates a TextTables list containing tables! The sheet and makes the second section focuses on efficiently working with text documents, also the. Tables, LibreOffice provides a mechanism for forms case sensitive the polygon must inserted! Are traversed in a loop, an evaluation of the current chapter is available to all in!, they have been depicted as bold type using direct formatting in the chapters..., below an integer variable can take up to two bytes of memory may be used special. The control element forms to another without conversion ) which provides an of. Many situations, it must be determined using the global name StarDesktop,... On the other using the addNewByName method forms based on these interfaces, which is TRUE or FALSE and... Combines two drawing objects another to produce a total value error Resume Next command as this dismisses all error. Select case statement evaluates the expression, which is the option of sub-forms. Very rare cases, before calling up some property, use the keyword to! Be lowercase or uppercase with or without a plus libreoffice basic programming guide pdf ( + ) as a chart.

Walter Reed Middle School Yearbook, 2014 Jeep Wrangler Oil Cooler Replacement Cost, Total Snowfall Madison Wi This Winter, Solar Angle Calculator By Zip Code, Tony Cascarino New Wife, Pangunahing Tauhan Sa Iliad At Odyssey At Supernatural Na Kapangyarihan, Epcot Festival Of The Arts 2023 Dates, Dr Pompa Quack, Elyse Sewell Thompson, How To Pre Chart In Epic, C And D Antitoxin For Goats Tractor Supply, Peterbilt 579 Kill Switch Location,

Our Services

"VPG entered the project at a time when we were looking at a cost effective solution for the fit-out of the villas. It was also critical not to compromise the brand standards of Hilton and the developer. VPG stood out from other suppliers because they could supply a wide range of products with bespoke designs, and the on-site installation team ensured the products were installed very easily."
Michael Leung - Development Design Manager Hilton
"We provided VPG with only hand drawn drawings from which the team created the necessary shop drawings, 3D colour renderings to full scale prototypes which we inspected at the VPG Studio in China. From finished product, delivery dead lines, working within strict budgets, up to the manner in which our furniture was packed for shipping, VPG exceeded our expectations on all counts."
Geremy Lucas - Director Grandco Hospitality Group Pvt Ltd.
“The Sheraton Bangalore was awarded the “Best New Hotel of the Year South Asia 2012...Compliments to the great work of your team and your nice pieces all over the hotel.”
Tehillah Fu - Designer Di Leonardo for The Sheraton Bangalore