Questions tagged [libreoffice-basic]

LibreOffice Basic is a procedural, interpreted programming language from the Basic family that can be used to write macros for applications in the LibreOffice Suite.

240 questions
13
votes
3 answers

Define global variables

I'm trying to test some algorithms in LibreOffice Calc and I would like to have some global variables visible in all cell/sheets. I searched the Internet and all the posts I have seen are so cryptic and verbose! What are some simple instructions of…
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
8
votes
3 answers

Changing cell background color in LibreOffice

I am using LibreOffice 3.5.4.2. I would like to change the background color of cells based on various conditions. As a minimal example, I have the following macro/function defined: function bgcolor() Dim Doc As Object Dim Sheet As Object Dim Cell As…
5
votes
1 answer

How do I check for broken internal links in Star Basic?

I am creating a Basic macro for LibreOffice Writer to check for broken internal links. In a nutshell: generate a list of all anchors loop through the document, finding internal hyperlinks if the internal hyperlink is not on the anchor list, open it…
5
votes
2 answers

Function accessing cell range

I don't find how to use cell ranges with functions. I vainly searched some examples. I wrote the following test. I get "Object variable not set" error on both "for" lines (one is without "RangeAddress", and the second is with it, because I'm not…
Gregory MOUSSAT
  • 832
  • 4
  • 13
  • 22
4
votes
1 answer

LibreOffice macro get index current sheet

Does someone know how to get the index of the current sheet in LibreOffice Macro Basic? I successed to get the name: cursheet = my_doc.getcurrentcontroller.activesheet.Name But how to get index? Moreover is there a place to find the documentation…
4
votes
1 answer

Generate new writer document from template with calc cell values

I have a LO Calc spreadsheet to collect my invoices in. I would like to automagically fill a new writer doc from a specific template with the values from one row of the invoice spreadsheet. Best would be to set the filename according to the calc…
4
votes
1 answer

Is there RefEdit control equivalent in Libre Calc?

Does anyone know what is Libre Calc’s equivalent for Excel’s RefEdit control? All other Excel UserForm controls seem to have corresponding controls for Libre Dialog forms. If there isn’t one, is it possible to tweak some other control (like Combo…
Davit Sargsyan
  • 1,264
  • 1
  • 18
  • 26
4
votes
2 answers

Libreoffice calc: loop throught cells macro

I've been searching a lot but could find little to no info about LibreOffice Basic I'm a bit used to programming macros in excel but this time a need to do a loop until i reach the first empty column and it needs to be in libreoffice. In excel i…
Newbie
  • 863
  • 1
  • 7
  • 16
3
votes
1 answer

Can you RECORD a macro in Python in LibreOffice?

There is a lot of information on how to RUN a Python macro in LibreOffice, but I couldn't find any on how to RECORD a Python macro (a bit like the old VBA or the new JavaScript macro recording in Excel)... I find recording useful for doing very…
Antonello
  • 6,092
  • 3
  • 31
  • 56
3
votes
2 answers

Libre Office Macro to crop image

I have a Libre Office Macro and I need to crop an image, but I have been unable to find any helpful documentation or an example. Anyone have a tip how to do it? dim noArgs() dim emptyDocComponent as object dim document as object dim dispatcher as…
3
votes
2 answers

replace (fix) fonts in LibreOffice Draw after importing PDF

I adapted BASIC macro to Draw but don't understand why it converted fonts only in first page. The code is: REM ***** BASIC ***** https://www.prahladyeri.com/blog/2016/02/ten-libreoffice-macro-recipes.html#searchandrepl Sub replace_letters Dim…
AndriuZ
  • 648
  • 6
  • 26
3
votes
3 answers

Libreoffice basic - Associative array

I come from PHP/JS/AS3/... this kind languages. Now I'm learning basic for Libreoffice and I'm kind of struggling to find how to get something similar as associative array I use to use with others languages. What I'm trying to do is to have this…
Xue Fang
  • 108
  • 9
3
votes
2 answers

why LibreOffice creates inverse question mark in equation when odt file imported from word doc or docx

I have equation in .docx file is when I save word file to .odt this equation becomes how can avoid this inverse question mark?
3
votes
1 answer

How to use LibreOffice functions into Basic?

I've asked here about the good way to do so. Now I'm trying the following code found here, and get some unexpected errors. I suppose I'm not using it the correct way. Any idea ? Sub Main Dim aResult Dim aFunc Dim oRange aFunc =…
Samuel
  • 594
  • 1
  • 6
  • 22
3
votes
1 answer

Where can I find the descriptin of LibreOffice API for BASIC

I wanted to create a few macros for LibreOffice using BASIC. However I cannot find the API description. It is absent in help as well as in interet. When I try to google it I get masses of examples in C++, Java, Python, but not a single www with…
Misery
  • 689
  • 2
  • 8
  • 25
1
2 3
15 16