Logical operators allow you to do operations on elements according to the rules of Boolean algebra. These provide the option of defining a variable search expression with placeholders and special characters rather than a fixed value. The example creates a TextTables list containing all tables of a text that are traversed in a loop. The text frame is finally assigned the This is a small test! string. In accordance with UNO philosophy, an Obj is described as a reference to an object which supports the com.sun.star.frame.Desktop service.

If the field proves to be a date/time field or an annotation, then the corresponding field type is displayed in an information box. com.sun.star.frame.Desktop resembles an object type; however in UNO terminology it is called a service rather than a type. In the Dialog Editor, the property values are shown symbolically, as Default (0), Okay (1), and Cancel (2). The following example demonstrates the use of ReplaceDescriptors for a search within a LibreOffice document. as is the case in the previous example for paragraphs. This code inserts the test.jpg graphic and adapts its appearance using the Adjust properties. 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. getting started with libreoffice writer. LibreOffice provides various functions that allow you to change the justification of a text in a table cell. StarOffice 5: In the past, text fields were accessed using a whole range of methods that LibreOffice made available in the old Selection object (for example InsertField, DeleteUserField, SetCurField).

The paragraphs can however be sequentially traversed with the help of the Enumeration object described in #Introduction to the API. getting started with libreoffice writer. WebSee the Draw Guide and LibreOffice Help for more information. 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. TRUE is -1 and FALSE is 0. The example is shown as in-line code, for clarity; in practice, the search would be inside a function, called with the name as a string parameter, and include error processing. Unlike C++ or Delphi, the LibreOffice Basic compiler does not create executable or self-extracting files that are capable of running automatically. A space in a local file name therefore, for example, becomes a %20 in the URL. Character objects in UNO, for example, provide the getPosition and setPosition methods through which the associated key point can be called up and changed. No programming knowledge is needed to use the corresponding functions. Here are the central methods of the com.sun.star.table.XtableRows interface: Whereas the getByIndex and getCount methods are available in all tables, the insertByIndex and removeByIndex methods can only be used in tables that do not contain merged cells. OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.4.3.2 on Ubuntu If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar. Note: The functions responsible are insertByName, removeByName and replaceByName. The program code for defining the hatch is very similar to the code for color gradients. The parameter provides the option of adding additional buttons, defining the pre-assigned button, and adding an information symbol.

Either way, the names of the data fields (from the Type definition) must be qualified by the name of the instance (from the Dim statement). These are presented in detail in the #Introduction to the LibreOffice API. The WaitUntil statement provides a greater degree of compatibility with VBA parameter usage. The hasByName, getByName and insertByName methods are obtained from the com.sun.star.container.XNameContainer interface as described in #Introduction to the API. As the name suggests, LibreOffice Basic is a programming language from the Basic family. A drawing object for a spreadsheet document, for example, can therefore only exist in conjunction with this one document. Thanks to these common features, all of these objects in LibreOffice support a common basic service called com.sun.star.text.TextContent. Alternatively, if only an empty document without any adaptation is needed, a private:factory URL can be specified: The call creates an empty LibreOffice writer document. libreoffice documentation letter flat macro overview basic pdf ide macros
The following program code shows how the Step value in event handlers of the Next and Prev buttons can be increased or reduced and changes the status of the buttons. In the first example, the sheet is accessed by its number (counting begins at 0). Some DOS-specific properties are no longer used in functions that expect file properties as parameters (for example, to differentiate from concealed files and system files). If you are interested in only the mouse click, your macro should ignore all calls where PopupTrigger is TRUE. It then creates an object that supports the com.sun.star.drawing.ShapeCollection service and uses the Add method to add the rectangle and the circle to this object. The X-axis points in reverse direction from right to left.
More information about the available services, and their interfaces, methods and properties can be found in the reference for the LibreOffice API. This returns an auxiliary object, which in turn provides the XEnumeration interface with the hasMoreElements and nextElement methods. The methods are accessed through the following object call: A format is specified using a format string that is structured in a similar way to the format function of LibreOffice Basic. 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 page properties that are valid for both types of documents are defined in the com.sun.star.style.PageProperties service. While test functions exist for checking numbers, date details and arrays in LibreOffice Basic, a corresponding function for checking Boolean values does not exist.

The XIndexContainer interface provides the insertByIndex and removeByIndex functions. Finally, in the last line, a new chart is added to this list using the addNewByName method.

LibreOffice Basic ensures that variable B is converted to a string during assignment to variable A. VBA: Unlike VBA, you cannot insert option buttons in a group of control elements in LibreOffice Basic. The following example is an algorithm that uses two loops to sort a list by names. A Boolean value is saved internally as a two-byte integer value, where 0 corresponds to the False and any other value to True. Unlike LibreOffice Basic identifiers, the names of control elements are case sensitive. The following example therefore displays a message that informs the user whether the Spreadsheet object contains a page of the name Sheet1. A chart may contain its own data or may display data from the container document. You do that by using the name of the object as a qualifier. If the text of the paragraph is now changed using the paragraph's String property, then LibreOffice first deletes the old paragraph portions and inserts a new paragraph portion. Like bubbles, the variables gradually migrate to the right position.

The replacement function of LibreOffice is particularly effective when used in conjunction with regular expressions. This based on the com.sun.star.sdb.DatabaseContext service and is the root object for all database operations. A VBA object is always assigned to precisely one single class. A variant is a universal variable that can record all conceivable values, including strings, whole numbers, floating point figures, and Boolean values. It combines all the pages within the spreadsheet. You will find an overview of the character and paragraph properties available in LibreOffice in the following two sections. A simple ResultSet, provides the minimum scope of functions available. The following example shows how a database context can be created and then used to determine the names of all data sources available. The two empty strings in the command line stand for the user name and password. Since LibreOffice Basic is a procedural programming language, several linguistic constructs have had to be added to it which enable the use of UNO. You specify the qualifiers in the With statement. The return value of a function can be any type. The following properties of an option button are available through its model object: The mechanism for grouping option buttons distinguishes between the control elements for dialogs and forms. In the previous example, if the UserInput variable contains a valid numerical value, then this is assigned to the ValidInput variable. They support the following property: The number of the current page can be inserted in a document using the com.sun.star.text.textfield.PageNumber text field. The following return values are available in this instance: In the previous example, checking the return values could be as follows: In addition to the information text and the parameter for arranging the information box, MsgBox also permits a third parameter, which defines the text for the box title: If no box title is specified, the default is soffice. LibreOffice Basic provides the getPropertyState method, with which programmers can check how a certain property was formatted. Here is an overview of the most important formatting properties and the points at which they are explained: The format properties are by no means restricted to the applications in which these are explained, but instead can be used universally. For example, the aforementioned object, which is based on the com.sun.star.frame.Desktop service, can also include other services for loading documents and for ending the program. The most important field types and their properties are described in the following sections. You can move the data from one list to the other using the buttons between the two list boxes. = 1. 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. If you want to format the individual objects of a group, apply the formatting before you add them to the group. As a function, CompatibilityMode() returns the Boolean value of the mode. The return value can be overwritten several times within the function. The example creates a Doc document object which references the current LibreOffice document. Checkboxes provide the following properties: The model object of a checkbox provides the following properties: The following example shows some of the properties for the checkboxes: These buttons are generally used in groups and allow you to select from one of several options. This code inserts a drawing element in a page and then adds text to the top left corner of the drawing object using the TextVerticalAdjust and TextHorizontalAdjust properties. Then you can use the "perpetual" Do Loop: The WhileWend loop construct works exactly the same as the Do WhileLoop, but with the disadvantage that there is no Exit command available. The properties are provided by the com.sun.star.util.SearchDescriptor service: The LibreOffice SearchSimilarity (or fuzzy match) function is also available in LibreOffice Basic. LibreOffice provides several ways of optimizing ResultSets and thereby controlling the speed of access. Establishing whether a section of a document has been directly or indirectly formatted is not easy. 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. placeholders in both VBA and LibreOffice Basic. The example first creates a document object for the text that has just been opened.

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). If the user changes one of the attributes of a style, then LibreOffice automatically adjusts all document sections depending on the attribute. Note: Page 2. To define your own color gradient, you need to complete a com.sun.star.awt.Gradient structure to assign the FillGradient property. The individual data sources are based on the com.sun.star.sdb.DataSource service and can be determined from the database context using the getByName method: The example creates a DataSource object for a data source called Customers. The text frame is therefore inserted directly in the text flow and behaves like a character. LibreOffice provides the com.sun.star.text.TextCursor service for more complicated tasks, including navigating backward within a document or navigating based on sentences and words rather than TextPortions. Building on this background, the following chapters will show how the API can be used to make LibreOffice do what you want it to do. In general, only parts of the interfaces are discussed. LibreOffice gives you the full package including Writer - the word processor, Calc - the spreadsheet application, Impress - the presentation engine, Draw - drawing and flow-charting application, Base - database and database front-end, and Math for editing mathematics. It inserts a new sheet with the name specified by the first argument, at the position specified by the second argument. A double variable can take up to eight bytes of memory. Pie charts (com.sun.star.chart.PieDiagram) do not contain any axes and cannot be stacked. WebOpenOffice Basic(formerly known as StarOffice Basic or StarBasicor OOoBasic) is a dialect of the programming languageBASICthat originated with the StarOfficeoffice suiteand spread through OpenOffice.organd derivatives such as Apache OpenOfficeand LibreOffice(where it is known as LibreOffice Basic). The strings of a Dialog can be localized, see the Developer's Guide chapter #Dialog Localization. When LibreOffice Basic encounters an incorrectly defined variable type in a particular context, an error message is generated. First, we will declare 3 Objects to define the Calc workbook, a collection of sheets and a cell. File:Pictures/10000200000001FA0000020FA21E926E.gif The regular expressions supported by LibreOffice are described in detail in the online help section for LibreOffice.