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
2
votes
1 answer

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.g.: ADDR | DATA |…
calcium3000
  • 177
  • 1
  • 10
2
votes
1 answer

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 Integer MyCharacter As Integer MyInitiative…
2
votes
1 answer

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 dispatcher =…
2
votes
1 answer

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
  • 9,355
  • 2
  • 15
  • 18
2
votes
0 answers

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. Are there current best practices related to this…
Samuel
  • 594
  • 1
  • 6
  • 22
2
votes
1 answer

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 project has many tasks and each task also has sub…
2
votes
1 answer

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: Sub TestSub Dim doc As Object doc =…
Jez
  • 27,951
  • 32
  • 136
  • 233
2
votes
1 answer

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 FROM Order GROUP BY Item ) As t2…
2
votes
2 answers

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 a search for a specific value in an adjacent…
jbobbylopez
  • 257
  • 2
  • 6
  • 15
2
votes
1 answer

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', u'numero': u'712', u'note': u"test…
Emilio Conte
  • 1,105
  • 10
  • 29
1
vote
0 answers

Openoffice or libreoffice, set alpha value on cell text color

In a python Calc macro, I want to be able to hide text in a cell. One way to do that is to get the background color of a cell and then set the text to that same color: bg_color = oCell.CellBackColor oCell.String = "Cell BG Color: " +…
CJH
  • 163
  • 1
  • 12
1
vote
1 answer

How to run a formula until it meets a certain criteria?

So, I have a formula ( =INDEX(Sheet1.A1:F15,RANDBETWEEN(1,15),RANDBETWEEN(1,6)) ) that returns a random number in the sheet. But, how to run the formula until the returned number is less than or equal to 25 ? I thought of using for..next.. but…
1
vote
1 answer

How do I add template name to status bar of libreoffice writer?

Here is a line from the file statusbar.xml from \share\config\soffice.cfg\modules\swriter\statusbar I copied the file…
shantanuo
  • 31,689
  • 78
  • 245
  • 403
1
vote
1 answer

getScriptProvider and createScriptProvider in Libre/Open/Collabra Office

If location="document" Then sp = ThisComponent.getScriptProvider() Else mspf = CreateUNOService("com.sun.star.script.provider.MasterScriptProviderFactory") sp = mspf.createScriptProvider("") End If That's a fairly standard example from…
david
  • 2,435
  • 1
  • 21
  • 33
1
vote
1 answer

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 property names for Major Interval Major Auto Major…
onemorequestion
  • 1,056
  • 1
  • 10
  • 15
1 2
3
15 16