How do I use JAVA to write calc macros ?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
JamesStone
Posts: 1
Joined: Sat Jan 06, 2018 5:15 pm

How do I use JAVA to write calc macros ?

Post by JamesStone »

Hi, I am new to macros in "OpenOffice Calc".
Long time ago I used macros in Excel, but as far as I remember, it looked very different.
Now I am struggling to build a spreadsheet to control some cryptocurrency transactions. I got into macro to automate some actions, but it seem that the language they call 'Basic' is very different from the 'Basic' as I remember it.

In the meantime, I started to learn JAVA, and I read somewhere that these macros can be written in JAVA.
(Is it so, or I misunderstood..)

If it is, I would like to use JAVA to write calc macros, instead of the current 'Basic' language

To accomplish that, I need 'how to' guide / instructions: in order to alter the setting of the calc Application so it will recognize and will operate by JAVA

Thank you.

James
Ubuntu 16.04 LTS
OpenOffice: Version: 5.1.6.2; Build ID: 1:5.1.6~rc2-0ubuntu1~xenial2
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: How do I use JAVA to write calc macros ?

Post by RoryOF »

The syntax of OO BASIC, as far as it applies to the standard operations, is almost identical to earlier BASICs. Where difficulty arises is the complexity of the calls to the underlying API functions of OpenOffice; this complexity will apply also if you use Java, Python or whatever. My advice is to stick with OO BASIC, reading the documentation at https://wiki.openoffice.org/wiki/Docume ... ASIC_Guide

Some careful internet searching will provide macro code (in OpenOffice) to do almost everything you are likely to require; this is easily adjusted for particular needs if one has any programming background.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How do I use JAVA to write calc macros ?

Post by Zizi64 »

If it is, I would like to use JAVA to write calc macros, instead of the current 'Basic' language
The API functions will be same - what you must call by your JAVA or BAsic code.

API = Application Programming Interface. It contains thousands of functions and procedures for control of the objects of the applications and for the objects of the documents.

The API descriptions and Andrew Pitonyak's free macro books will help you.
http://www.pitonyak.org/oo.php
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How do I use JAVA to write calc macros ?

Post by Villeroy »

How to tell the same thing to the same application in 5 languages: https://wiki.openoffice.org/wiki/Docume ... ing_Macros
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply