Page 1 of 1

[Solved] Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 9:48 am
by rafael.alvamar
Hi guys,

I would like to add a checkbox on a Sheet on Calc program using Java code.

Now, I have all the code to connect to the file, but I don't know how add a checkbox on the sheet and using after that in my code.

I will be so happy if you could say how do it and where I could find a good reference of the API for Java.

Thanks.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 10:06 am
by Zizi64
Put it onto the sheet manually, and control the visibility of it by your code.

The LO API is same for every programming languages. (maybe you can not control/handle some feature in one or the other IDE/language, but the API functions, procedures and objects are same.)

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 1:09 pm
by JeJe
There appear to be very few people using OO with Java and therefore relatively few resources available and few people to help you. You'll usually be able to find what you want to do in Basic and will have to translate.

https://wiki.openoffice.org/wiki/Docume ... and_Shapes

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 9:24 pm
by rafael.alvamar
Zizi64 wrote:Put it onto the sheet manually, and control the visibility of it by your code.

The LO API is same for every programming languages. (maybe you can not control/handle some feature in one or the other IDE/language, but the API functions, procedures and objects are same.)
How can I control the visibility of it by code? Sorry, but I'm learning this API.

Thanks for your help.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 9:27 pm
by rafael.alvamar
JeJe wrote:There appear to be very few people using OO with Java and therefore relatively few resources available and few people to help you. You'll usually be able to find what you want to do in Basic and will have to translate.

https://wiki.openoffice.org/wiki/Docume ... and_Shapes
This link is wonderfull for my needs. Thank you so much.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 9:34 pm
by JeJe
Setting the visibility is an example of what I was saying about finding it in Basic and translating. The API is the same for all languages

viewtopic.php?f=20&t=27081

.setvisible(false) or .setvisible(true)

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Wed Oct 28, 2020 9:59 pm
by JeJe
You might find MRI helps. You can inspect an object and easily see all its properties and methods such as setvisible.

https://extensions.openoffice.org/en/pr ... ction-tool

It can help you write your code, for example

viewtopic.php?t=55835#p245258

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Thu Oct 29, 2020 12:50 am
by Villeroy
Generating complex form documents by code is a misconception. Simply use templates. Templates provide the core functionality of any office suite.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Thu Oct 29, 2020 11:12 am
by rafael.alvamar
JeJe wrote:You might find MRI helps. You can inspect an object and easily see all its properties and methods such as setvisible.

https://extensions.openoffice.org/en/pr ... ction-tool

It can help you write your code, for example

viewtopic.php?t=55835#p245258
Very useful. I will try it.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Thu Oct 29, 2020 11:18 am
by rafael.alvamar
Villeroy wrote:Generating complex form documents by code is a misconception. Simply use templates. Templates provide the core functionality of any office suite.
I will study this option. Thanks.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Thu Oct 29, 2020 1:29 pm
by Villeroy
A template is an almost normal office document with all the layout, formatting, form controls and contents except for content that needs to be added by a user. A template opens as a new document with a document title like "Untitled 1". When the user saves it, he will be prompted for the path name of a new document. You open a letter template for a new letter and type in the letter text. You open a productivity template for a new profit calculation with all layout, formatting, input cells and formulas predefined. SInce more than 30 years, this is the core of office software and it does not require any kind of programming skills.

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Thu Oct 29, 2020 6:04 pm
by UnklDonald418
Look at this link for using the LO/OO API in JAVA
http://fivedots.coe.psu.ac.th/~ad/jlop/#contents
I believe chapter 40 discusses checkboxes

Re: Adding a Checkbox on a Stylesheet on Calc with Java

Posted: Thu Oct 29, 2020 8:02 pm
by rafael.alvamar
Wow you're awsome! Thanks a lot for your help. Now I have how start my study.