Information request

From what I see there are a lot of people like me who are struggling to work AO/LO BASIC to achieve what they want. There are many much appreciated helpers here, but the odd one that seems to delight in making things difficult or ridiculing such requests - (on a ‘Help’ forum!).

We are constantly told to ‘look at the API’. In my case, it is setting Calc print area that I have been having trouble with lately. I look at the API, ‘XPrintAreas Interface Reference’. There, plain as the hand in front of my face is the Public Member Function ’ setPrintAreas()’. Great. OK. Now, how do I use that in BASIC? Can I see the way to do it? How does one access these functions? What are the magic words I need to translate that into BASIC? The Developers Guide - First Steps gives ‘hints’ but some way to learn the 'translation into BASIC would be very useful. XRay/MRI doesn’t really help in this task. Picking up code snippets from others is not the best way to learn (although it often eases the pain!).

Any pointers?

1 Like

Everyone has it differently. When I started programming for this office suite, “Andrew Pitonyak” became such magic words for me.
Right now, I opened a copy of the book Useful Macro Information For OpenOffice.org By Andrew Pitonyak, which is saved on my machine, found the word “Print” in the table of contents (the fourth of them - the first three for Writer, not Calc) and saw this:

Just try it. It is not necessary to read the whole book at once - just find the necessary fragments in the table of contents and use it. After a while, you will read most of this book and suddenly you will understand how useful you can get from MRI (exactly in this sequence - a little practice in using ready-made code and only then using the tool for examining office objects)

PS. Don’t be offended by people whose advice you don’t understand. We all came to LibreOffice programming from different angles. Someone has been writing programs all his life according to the principle “I see the ultimate goal and step by step, line by line, I write the code that will lead to this goal.” And it is with such skills that he writes macros. And someone was more fortunate and from the very beginning and for a very long time he always worked with someone written code, ready for use, as with Lego blocks - he chose the right ones from the set and quickly folded the finished working structure. And for him, “API documentation” is a simple and understandable tool, just by looking at the name of the method, he understands whether he needs this “cube” to solve the current task. All people are different. Don’t be offended

1 Like

John - thank you again. I had already found that reference and it was posted in the other topic I am running yesterday. - and it works!

I am not ‘offended’, John, just annoyed. Having spent a large part of my life ‘teaching’ and helping people to acquire a particular skill I am saddened when that is missing.

1 Like

Doesn’t the dedicated hub for macro-related documentation address this?

1 Like

@mikekaganski Unfortunately, this part has not yet been published

True. Still, as I read the question, the print areas problem is just an example, and the question is generic: what is the place where a macro author can seek information. And that wiki page is intended for that. Being a wiki, it asks for contributions (adding useful sources, fixing problems, etc.)

I think John has summed it up. Way to go? It still does not answer the question how do we learn how to move from API to BASIC?

https://forum.openoffice.org/en/forum/viewtopic.php?t=49294

Trying to set print ranges programmatically is a nightmare. Why do you try to do that?