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.

Filter by
Sorted by
Tagged with
14 votes
3 answers
7k views

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 ...
Foad S. Farimani's user avatar
9 votes
3 answers
18k views

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() ...
SabreWolfy's user avatar
  • 5,510
5 votes
2 answers
6k views

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 "...
Gregory MOUSSAT's user avatar
5 votes
1 answer
280 views

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 ...
Júlio Reis's user avatar
4 votes
2 answers
24k views

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 ...
Newbie's user avatar
  • 873
4 votes
1 answer
7k views

Using regex in a libreoffice calc macro to extract text from parentheses in a cell

Using Libreoffice 3.5.7.2 on Ubuntu 12.04. I have text in calc cells in the form of: (IBM) Ibm Corporation. I am trying to use regex to extract the text between the ()'s using a basic macro. This is ...
Agent_15x's user avatar
  • 383
4 votes
1 answer
4k views

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? ...
Lemaitre Cedric's user avatar
4 votes
1 answer
189 views

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 ...
Davit Sargsyan's user avatar
4 votes
1 answer
2k views

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 ...
lars k.'s user avatar
  • 572
3 votes
4 answers
15k views

Path of current document in [Libre|Open]Office

How can I determine the path of the currently open document in an OpenOffice or LibreOffice document? I want to forward the path to an external application. More specifically I want to launch an ...
dubbaluga's user avatar
  • 2,313
3 votes
2 answers
3k views

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?
sachin pawar's user avatar
3 votes
1 answer
699 views

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 ...
Antonello's user avatar
  • 6,283
3 votes
1 answer
2k views

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 ...
Samuel's user avatar
  • 638
3 votes
1 answer
2k views

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 ...
Misery's user avatar
  • 689
3 votes
2 answers
2k views

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-...
AndriuZ's user avatar
  • 658
3 votes
3 answers
2k views

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 ...
Xue Fang's user avatar
  • 108
3 votes
1 answer
888 views

Libre office calc trigger BASIC function using button

I wrote a little BASIC function in libreoffice to get some sorting stuff done. Works nicely.. Now I want to trigger this function by pushing a button on the first sheet. I really don't get it working....
Michael's user avatar
  • 756
3 votes
1 answer
3k views

What is the function Debug.Print (VBA) for Oobasic or StarBasic in LibreOffice?

I'm writting a macro in LibreOffice and woudld like to print somethings in the IDE window of LibreOffice. In VBA I use Debug.Print to print some values in the IMMEDIATE Window. What is the function ...
jMcfly's user avatar
  • 45
3 votes
2 answers
1k views

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 ...
Dan Littlejohn's user avatar
2 votes
1 answer
5k views

how to do http request using libreoffice basic macros

I want to write a macro on a LibreOffice spreadsheet, to send an HTTP request to an web URL and receive a JSON like response. Can i do it with LibreOffice basic macro programming? Where can i get ...
Antonio Fernandes's user avatar
2 votes
2 answers
15k views

Libreoffice : Referencing cells in another worksheet via FIND(), LOOKUP(), or EXACT()?

I'm trying to learn LibreOffice's scripting capabilities, and have a specific scenario that I haven't been able to figure out. What I'm trying to do is get the value from another worksheet, by doing ...
jbobbylopez's user avatar
2 votes
1 answer
2k views

LibreOffice Calc macro to save a named sheet in a csv file

There is a Calc file named as 'Data.ods' with a sheet named 'DataSheet' which should be saved in a 'Data.csv' file in the current directory using {tab} as field delimiter and double quoted data ...
Ds1715's user avatar
  • 41
2 votes
1 answer
554 views

Using built in Calc function when recording a macro

I am working through Excel for Engineers and trying to adapt it for LibreOffice Calc. I have run into a problem. I know this is easier to do without using macros but humor me. One of the exercises ...
Jay's user avatar
  • 75
2 votes
1 answer
204 views

Lack of access to all functions in exposed interfaces?

I have a rather fundamental issue with coding in OpenOffice/LibreOffice Basic that I can't seem to figure out. I don't always have access to all the functions I'm supposed to. Here's an example: ...
Jez's user avatar
  • 28.7k
2 votes
1 answer
211 views

How to run a script from another document

I have two doc LibreOffice calc test1.ods and test2.ods. I want run a script in test2 from the script of test1. When test2 is open by the script of test1, i can't run the script on test2 even from ...
patol's user avatar
  • 136
2 votes
1 answer
3k views

How to programmatically open and modify ODT file from Calc Macro

I am writing a Macro programm in a LibreOffice Calc spreadsheet. This macro should do the following (amongst other things): open an existing ODT text document as a template search and replace some ...
Martin Wunderlich's user avatar
2 votes
1 answer
1k views

Calculating logarithm own base in Basic (LibreOffice Calc Macro)

LibreOffice has function LOG(x;n) where you can define your own base. However, when I use Macro to write function in Basic, It does not take second parameter into account thus calculating natural ...
Grzegorz's user avatar
  • 3,558
2 votes
1 answer
567 views

Resize and modify selected chart with libreoffice basic

I'm writing a macro with libreoffice basic to modify the styles and size of a selected (and only selected) chart in my spreadsheets. After many documentation reading and many tries, I managed to have ...
JeanJouX's user avatar
  • 2,603
2 votes
1 answer
456 views

LibreOffice calc Hyperlink from macro doesn't work

I have trouble making hyperlink within macro. For example just create empty spreadsheet and create another sheet within so we have 2 empty sheets. In Sheet1 A:1 just paste =HYPERLINK("#Sheet2") For ...
eSlavko's user avatar
  • 348
2 votes
1 answer
98 views

"base" Keyword in LibreOffice Basic

I'm writing a macro for LibreOffice Calc in Basic in VBA compatibility mode. It complains when I use this line: Const BASE = 3 BASIC syntax error. Symbol expected. and the syntax coloring seems ...
Dennis Williamson's user avatar
2 votes
1 answer
608 views

How do we import the listener events of LibreOffice Writer in Visual Basic 6

How do we import the listener events of LibreOffice writer in Visual Basic 6? I am trying to create a UNO service to get container listener event like following code, Dim oListener As Object ...
Raja Sahe S's user avatar
2 votes
1 answer
1k views

How to count duplicate entries in OpenOffice/LibreOffice BASIC?

I have a gnarly amount of data across many sheets in LibreOffice -- an ADDRESS column and a DATA column -- and I'd like to count the number of times each address occurs, put into a NUM_ADDR column. E....
calcium3000's user avatar
2 votes
1 answer
1k views

Open/Libre Office macro to scroll view to selection

In Writer, I would like to search for some text and when found position the view to the top of the view/window. Using the following code, document = ThisComponent.CurrentController.Frame ...
Dude named Ben's user avatar
2 votes
1 answer
4k views

How to export cell range to PDF file?

I have following code to export a sheet to a PDF file: Option Explicit Sub exportToPdf Dim document As Object Dim dispatcher As Object document=ThisComponent.CurrentController.Frame ...
Maciej's user avatar
  • 9,475
2 votes
1 answer
4k views

Open a form in Libreoffice/Openoffice Base with a specific filter/query

I am creating a Libreoffice Base with multi forms. Form1 is linked to "Projects" table and each Project has multiple tasks, I can display the tasks as sub form within the same Form1, however, each ...
Fahad Alduraibi's user avatar
2 votes
1 answer
531 views

sql works in libreoffice base but not libre basic

I have a classic question about getting the latest record from a table. Here is the statement: SELECT t1.Item, t1.Price, t1.ODate FROM Order AS t1 JOIN ( (SELECT Item, Price, Max(ODate) As MaxDate ...
user2301156's user avatar
2 votes
1 answer
317 views

calling a dict from python to a basic macro in openoffice

From a Basic macro, I launch a Python script that returns a json input as following : { u'commande': { u'nom_commande': u'TEST PANIER EXPRESS', u'statut_commande': u'prepa', ...
Emilio Conte's user avatar
  • 1,115
2 votes
1 answer
67 views

Remove save keyboard shortcut using script

Let's assume I need to remove the Ctrl+S keboard shortcut that is used to save a document in Libreoffice writer. I can change the function using this code... <node oor:name="S_MOD1&...
shantanuo's user avatar
  • 32k
2 votes
0 answers
160 views

Writing libreoffice-calc macros in Visual Studio Code

I'd like to write libreoffice-calc macros (libreoffice-basic) in Visual Studio Code instead of the embedded macro editor. I know xlwings enables such functionality when working with excel, as ...
Pascal's user avatar
  • 46
2 votes
0 answers
26 views

Will async operations finish before workbook is closed?

I have searched and read the API description, but I can't find an answer whether async operations are forced to be completed before LibreOffice Calc is closed. For example: dispatcher.executeDispatch()...
Mike KMB's user avatar
2 votes
0 answers
723 views

LibreOffice Command Line Open Docx File, On Linux

I need to open Docx file using LibreOffice in command line mode. libreoffice6.0 -o [filename].docx Then.. This command is running in script, I can't handle the confirm window. So is it possible to ...
world hello's user avatar
2 votes
1 answer
1k views

LIBRECALC Separate cell contents into new row (comma separated), but duplicate other contents

I mostly use R for my data analyses, but I was hoping for an easier upfront fix for my dataset within LibreCalc. Essentially, I have a dataset I am collecting for research in the field and, for ...
Alex Pritchard's user avatar
2 votes
1 answer
300 views

LibreOffice Basic Ignoring “some” of my Type...End Type Definition

I'm using LibreOffice Version: 4.4.3.2 Build ID: 40m0(Build:2) Locale: en_AU I have a Basic Module At the top of this module before any sub or functions I have Type InitHeadings MySort_By As ...
Jesse the Wind Wanderer's user avatar
2 votes
0 answers
297 views

Good usage of native functions in LibreOffice Basic?

I've read here that we can use a pretty complicated syntax in order to have access to LibreOffice functions in the Basic macro editor, rather than writing functions in a sheet and get the data back. ...
Samuel's user avatar
  • 638
1 vote
1 answer
98 views

How to store in a variable, the range address from a user selected range

I want a variable to store the "range address" (e.g. "B2:E4") of a range that was selected by a user. I'm trying things along these lines: Sub print_selected_range Dim oSheet as ...
Micklos's user avatar
  • 137
1 vote
1 answer
141 views

LO Calc Basic - What is the right property name for the axis major/minor settings and how to set them correctly?

Using a libreoffice basic macro for charts, we can control the maximum value of an axis and turn the automatic mode on/off: oAxis.AutoMax = False oAxis.Max = 12345 But what are the right ...
onemorequestion's user avatar
1 vote
1 answer
2k views

How to insert line breaks in strings

How to insert line breaks when writing macros in libreoffice calc? e.g: oCell.SetString("hello /? world!") Out: hello world!
kendallbp's user avatar
1 vote
1 answer
3k views

Scroll bar in LibreOffice dialog

I am trying to make an image picker component in LibreOffice. I have a dialog that is dynamically filled with images. When the user clicks on one images, it should be selected and the dialog should be ...
Beemen's user avatar
  • 98
1 vote
1 answer
920 views

LibreOffice basic math function

I need to power some values in librebasic macrocode. We have func POWER(A; B) but its Syntax is "cell-formula" But I need something like "pow" as native basic func. I tried SQL func POWER(X,Y) ...
user3003873's user avatar
1 vote
2 answers
3k views

passing an array in "Basic" OpenOffice Programming

I've been asked to do something at work, and being that I'm running Ubuntu and not Windows, I have Libre Office (LO Writer is the equivalent of Word). - The task is to automate some contracts, where ...
orepor's user avatar
  • 926

1
2 3 4 5 6