Automate Format → Columns

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
Solomoriah
Posts: 3
Joined: Tue Nov 29, 2022 8:07 pm

Automate Format → Columns

Post by Solomoriah »

 Edit: Split from Automating FormatColumns because that topic is not yours and you should have your own. Please do not post in another's topic unless you are helping to solve their problem for them. And criticizing volunteers here does not seem to me to be a good way to introduce yourself on your first post!
-- MrProgrammer, forum moderator  

I realize this is thread necromancy, but I literally created an account just to point out that Zizi64 could not have read the question before answering. I too have the same problem as the OP and am trying to find a reference for the signature of uno:FormatColumns so I can automate it.

For the record, Zizi64, I am in WRITER not Calc, and I'm 100% certain the OP was also.

So where in the heck are these things documented?
Last edited by MrProgrammer on Tue Nov 29, 2022 9:54 pm, edited 1 time in total.
Reason: Split topic
OpenOffice 4.1 Windows 10
mplaut
Posts: 27
Joined: Thu May 06, 2010 12:41 am

Re: Automate Format → Columns

Post by mplaut »

Bravo Solomoriah. Yes I certainly was in Write.
Also I think the best and easiest way to program macros is to record the steps and then to modify the code generated. I have done this many times with success.
M Plaut
Openoffice 4.1.4 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11364
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Automate Format → Columns

Post by Zizi64 »

My first hint (copied from the original thread) is true in all of the applications:
1.: The usage of the Macrorecorder is not efficient method for programming the Calc applications.
You need study the API (application Programming Interface), the StarBasaic (or other built-in programming language, and you need use them.
The Macro Recorder of the AOO/LO has a limited capability and it can not record all of the user's activity. And it works in the Writer and Calc applications only, but not in the Draw nor in Impress.



Yes, my second hint is usable for the Calc only...
2.: Use Styles (in this case: Cell styles) instead of direct formatting. You can apply the existing (created) styles manually, or by your macro.
Otherwise the newer versions of the LibreOffice have a special Style for the Writer Tables. (I have not used it yet).



My third hint:
Install one of the excellent Object Inspection Tools: XrayTool or MRI. Then you will able to list the existing properties and methods of the programming objects of the API.
https://berma.pagesperso-orange.fr/index2.html
https://extensions.libreoffice.org/en/e ... ction-tool





The OpenOffice is dead: The latest version is the AOO 4.1.13 - that means only one main, and a few new subversions since year 2015. The LO was forked at the version number 3.3, and the latest version of the LO is the 7.4.3 today:
https://en.wikipedia.org/wiki/LibreOffice#History
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.
Solomoriah
Posts: 3
Joined: Tue Nov 29, 2022 8:07 pm

Re: Automate Format → Columns

Post by Solomoriah »

First of all, sorry for the crankiness. The thread I replied to was literally the only one on the entire Internet where the OPs problem was the same as mine, so finding that the only reply was not an answer to their question was quite frustrating. But honestly, it was an overreaction, Zizi64, and you did not deserve that. I am sorry.

I've tested this with new LibreOffice and it does exactly what mplaut complained about with OOo in 2015, so no improvement there. Why in the world does a mature project ecosystem have no documentation for this kind of interface?

Was not aware of the Object Inspection Tools. This is useful, thank you! I did eventually find sketchy documentation for the underlying interfaces and I am beginning to wonder if this kind of automation actually does not work at all.
OpenOffice 4.1 Windows 10
User avatar
Hagar Delest
Moderator
Posts: 32670
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Automate Format → Columns

Post by Hagar Delest »

mplaut wrote: Wed Nov 30, 2022 12:14 am Also I think the best and easiest way to program macros is to record the steps and then to modify the code generated.
I fully disagree!
The recorder provides a code with a bunch of parameters you don't understand. Better use the right code to understand what it is doing. You'll be able to change it later if the code has to be modified.
Very often, what you want to do has been already coded somewhere and you just need to adjust the code snippet. The main skill is to find that code snippet.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Solomoriah
Posts: 3
Joined: Tue Nov 29, 2022 8:07 pm

Re: Automate Format → Columns

Post by Solomoriah »

I'd agree with you, Hagar, if I hadn't just spent (wasted) a lot of time failing to find documentation on the functions I need. Having seen how the macro recorder does it, I can often infer what isn't documented. But in this case the macro recorder doesn't know how to do it at all... the recorded macro, replayed, does not do what I did when recording it.
OpenOffice 4.1 Windows 10
Post Reply