[Solved] AOO and LibreOffice macros

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

[Solved] AOO and LibreOffice macros

Post by OldStd »

Zizi64 said
The OpenOffice.org (OO.o) and the NeoOffice 2.2.3 are archaic-old versions.
https://en.wikipedia.org/wiki/LibreOffice#History
Use a recent version.
I only heard of LibreOffice in this forum very recently. I am still using Apache OpenOffice 4.1.5.

Shall I uninstall it, download and install LibreOffice 6.1.3?

Are the oOo macros the same in LibreOffice? Where do I get the LibreOffice tutorials from?
 Edit: I've removed this discussion to a new topic. Please don't hijack other's topics, especially when the issue is different. [robleyd - Mod] 
Last edited by OldStd on Sat Nov 10, 2018 5:52 am, edited 1 time in total.
Openoffice 4.15
Windows 10
User avatar
Zizi64
Volunteer
Posts: 11360
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: OOo and MS Office macros

Post by Zizi64 »

I only heard of LibreOffice in this forum very recently. I am still using Apache OpenOffice 4.1.5.
Shall I uninstall it, download and install LibreOffice 6.1.3?
Are the oOo macros the same in LibreOffice? Where do I get the LibreOffice tutorials from?
1.:
I am still using Apache OpenOffice 4.1.5.
Shall I uninstall it, ...?
You can install the LibreOffice near the OpenOffice. The file types (default editor for the doc/odt xls/ods, etc... extensions) will be assigned to that office suite what you will install later.
Or you can try a portable version of the LibreOffice. The portable versions will not reassociate the default editors for the document files.
http://www.winpenpack.com/en/download.php?list.37
https://portableapps.com/apps/office/li ... e_portable
https://portableapps.com/apps/office/li ... able-still
https://portableapps.com/apps/office/li ... legacy-5.4




2.:
Are the oOo macros the same in LibreOffice?
Yes. It is true in the 99,5% of cases. (There are minimal differences between the API functions by now)


3.:
Where do I get the LibreOffice tutorials from?
http://www.taming-libreoffice.com/category/books/
https://wiki.documentfoundation.org/Doc ... blications
https://help.libreoffice.org/latest/en- ... n0000.html


4.:
download and install LibreOffice 6.1.3?
There are two main versions of the LibreOffice: the Still One , and the Fresh one. LO 6.0.7 is the recent Still version today, and the recent Fresh is the LO 6.1.3: I suggest you use the Still version.
https://www.libreoffice.org/download/download/
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.
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: OOo and MS Office macros

Post by OldStd »

Zizi64 wrote: You can install the LibreOffice near the OpenOffice. The file types (default editor for the doc/odt xls/ods, etc... extensions) will be assigned to that office suite what you will install later.
Or you can try a portable version of the LibreOffice. The portable versions will not reassociate the default editors for the document files.
http://www.winpenpack.com/en/download.php?list.37
https://portableapps.com/apps/office/li ... e_portable
https://portableapps.com/apps/office/li ... able-still
https://portableapps.com/apps/office/li ... legacy-5.4

2.:
Are the oOo macros the same in LibreOffice?
Yes. It is true in the 99,5% of cases. (There are minimal differences between the API functions by now)

3.:
Where do I get the LibreOffice tutorials from?
http://www.taming-libreoffice.com/category/books/
https://wiki.documentfoundation.org/Doc ... blications
https://help.libreoffice.org/latest/en- ... n0000.html

4.:
download and install LibreOffice 6.1.3?
There are two main versions of the LibreOffice: the Still One , and the Fresh one. LO 6.0.7 is the recent Still version today, and the recent Fresh is the LO 6.1.3: I suggest you use the Still version.
https://www.libreoffice.org/download/download/
Greetings. Zizi64.

Thanks for taking the time to give me advice and providing the links to training materials.
I have downloaded some of the PDF on Writer, Calc, Macros, and Getting started.
I have downloaded and installed LibreOffice 6.0.7 side-by-side with my old Apache OpenOffice 4.1.5

This will keep me busy for quite a while.

Thank you.
Openoffice 4.15
Windows 10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: OOo and MS Office macros

Post by Villeroy »

OldStd wrote: This will keep me busy for quite a while.
Apart from several questionable changes in the LO user interface, both applications are very much identical. Unless you are going to manipulate the user interface programatically, the APIs are the same even for those features where the user interface has changed radically. For instance, Calc's conditional formatting works in the same ways although the dialog looks completely different.
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
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: AOO and LibreOffice macros

Post by OldStd »

robleyd wrote:
 Edit: I've removed this discussion to a new topic. Please don't hijack other's topics, especially when the issue is different. [robleyd - Mod] 
Thanks for pointing this out. I know what to do next time.
Openoffice 4.15
Windows 10
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: OOo and MS Office macros

Post by OldStd »

Villeroy wrote: Apart from several questionable changes in the LO user interface, both applications are very much identical. Unless you are going to manipulate the user interface programatically, the APIs are the same even for those features where the user interface has changed radically. For instance, Calc's conditional formatting works in the same ways although the dialog looks completely different.
Thanks. Villeroy. It'll take me quite a while to experience and appreciate what you said here.
Openoffice 4.15
Windows 10
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved] AOO and LibreOffice macros

Post by JeJe »

I use OpenOffice because LibreOffice crashed more when I tried it and because macros written in OpenOffice are more likely to be compatible with both than if I write them in LibreOffice.

That's because LibreOffice have made more changes since the two split from their common ancestor. For example (in the IDE) the label control in LibreOffice has vertical alignment and the dialog has scrollbars. If you set those in LibreOffice and then expect it to work in OpenOffice then of course there will be a problem. You can do those things in OpenOffice - but not through the IDE.

From memory (which is sometimes faulty) the scrollbar controls are no longer compatible.

There have been examples in this forum recently where code on one won't work on the other. It doesn't matter if you're just coding for yourself - you pick whichever you want to use and code in that. If you're writing an extension or something that other people will use it may be an issue.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] AOO and LibreOffice macros

Post by Villeroy »

LibreOffice upgraded the Python runtime to Python 3. It is not very difficult to write macros compatible with Python 2.
Strangely, OpenOffice form controls for dates and times accept integer values (20181130 and 234559) instead of UNO structs. LibreOffice uses UNO structs. LibreOffice time structs have nano seconds and time zone information where OpenOffice stores only hundredth seconds.
Oh, and then I stumbled upon some differences in the form container hierarchy of a Base document.
Nothing of the above will ever be noticed by StarBasic coders hacking some macros for Writer or Calc.
Until now I always managed to develop with LibreOffice and make it backwards compatible to OpenOffice without too much effort. As an example you may refer to my "universal date-time converter" in StarBasic: viewtopic.php?t=82181
In Module1.Main you find

Code: Select all

if isUnoStruct(ctrlDate.getDate()) then
REM this is LibreOffice 4
	sDType = "UNODATE"
	sTType = "UNOTIME"
else
REM this is OpenOffice or LibreOffice 3
	sDType = "INTDATE"
	sTType = "INTTIME"
endif
which specifies the correct type of date and time depending on the types of values returned by the dialog controls.
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
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

Hi. Jeje.
Thanks for the comments and info.

It'll take a while before I come to learn how to write extension.
Openoffice 4.15
Windows 10
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

Hi. Villeroy.

Thanks for the comment and info, and the attached tutorial in "universal date-time converter". This will come in handy in time to come.
Openoffice 4.15
Windows 10
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

Hi. Everyone.

I have encountered a small problem:

How to comment out a whole block of text inside the AOO codes, or LibreOffice macro?

In some other programming language, it could be something like this:
  • /*
    This is commented out.
    This is commented out.
    This is commented out.
    This is commented out.
    */
Your advice will be much appreciated.
Openoffice 4.15
Windows 10
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] AOO and LibreOffice macros

Post by RoryOF »

Enclose it in an IF structure, where the code in the IF structure is controlled by a Boolean.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved] AOO and LibreOffice macros

Post by JeJe »

In Basic you need to comment out each line with an ' in front of each - there is no block comment.

This extension helps make commenting and uncommenting a selection of text easy (as well as having other useful features):

https://extensions.openoffice.org/fr/pr ... -ide-tools
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

Hi. Jeje.

Thanks for the link.
I have installed the extension. Now I have to learn how to use the tools.
Openoffice 4.15
Windows 10
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

JeJe wrote:In Basic you need to comment out each line with an ' in front of each - there is no block comment.

This extension helps make commenting and uncommenting a selection of text easy (as well as having other useful features):

https://extensions.openoffice.org/fr/pr ... -ide-tools
Hi. Jeje.

I have installed the extension. However, I couldn't find the related toolbar in my LibreOffice documents.

If I highlight a block of codes, and press [ctrl][shift] and c as suggested, I can get the block commented out, but I can't un-comment any comments by pressing [ctrl][shift]x as suggested.

I can't access any other commands from the IDE extension.

What can be done, otherwise?
Openoffice 4.15
Windows 10
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved] AOO and LibreOffice macros

Post by JeJe »

Did you download the right version?

"Note: For LibreOffice, download version 1.2. To display the context (popup) menu, make two clicks with the right mouse button."

https://extensions.openoffice.org/fr/pr ... -ide-tools
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

Hi. Jeje.

I downloaded version 1.2 and reinstalled it.
Yes the IDE toolbar is now showing. Unfortunately, the labels are in a language I don't understand.
I can make use of at least two buttons. [Comment] and [Indent]. No button for [un-comment].

Thanks for the info.
Openoffice 4.15
Windows 10
User avatar
robleyd
Moderator
Posts: 5085
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: [Solved] AOO and LibreOffice macros

Post by robleyd »

Did you try following the link on the extension page where it says "See online help for details (with videos, English translation)"
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved] AOO and LibreOffice macros

Post by JeJe »

the button to the left of the comment button, with the two arrows, uncomments.

As robleyd says, there's a link to the online help in English on that page

https://wiki.open-office.es/Basic_IDE_T ... OpenOffice
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
OldStd
Posts: 116
Joined: Tue Sep 11, 2018 8:46 pm

Re: [Solved] AOO and LibreOffice macros

Post by OldStd »

Greetings. Jeje and Robleyd.

Thanks for the links and the advice.

Yes. I have read the English translation. In the footnote of the download site, it said there were no translation to the tooltips. They are still in Spanish.

The tooltips are different from those shown in the online explanation.

Thanks all the same.
BasicIDETools
BasicIDETools
Openoffice 4.15
Windows 10
Post Reply