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

The Application Programming Interface and the OASIS Open Document Format

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

Postby rafael.alvamar » Wed Oct 28, 2020 9:48 am

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.
Last edited by Hagar Delest on Fri Oct 30, 2020 12:33 pm, edited 1 time in total.
Reason: tagged solved
OpenOffice 4.1.17 on Windows 10
Java developer
rafael.alvamar
 
Posts: 7
Joined: Wed Oct 28, 2020 9:40 am

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

Postby Zizi64 » Wed Oct 28, 2020 10:06 am

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.)
Tibor Kovacs, Hungary; LO6.1.6, 6.4.7 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.1.1;AOO4.1.9
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
Zizi64
Volunteer
 
Posts: 9938
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby JeJe » Wed Oct 28, 2020 1:09 pm

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
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1596
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby rafael.alvamar » Wed Oct 28, 2020 9:24 pm

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.
OpenOffice 4.1.17 on Windows 10
Java developer
rafael.alvamar
 
Posts: 7
Joined: Wed Oct 28, 2020 9:40 am

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

Postby rafael.alvamar » Wed Oct 28, 2020 9:27 pm

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.
OpenOffice 4.1.17 on Windows 10
Java developer
rafael.alvamar
 
Posts: 7
Joined: Wed Oct 28, 2020 9:40 am

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

Postby JeJe » Wed Oct 28, 2020 9:34 pm

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)
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1596
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby JeJe » Wed Oct 28, 2020 9:59 pm

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
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1596
Joined: Wed Mar 09, 2016 2:40 pm

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

Postby Villeroy » Thu Oct 29, 2020 12:50 am

Generating complex form documents by code is a misconception. Simply use templates. Templates provide the core functionality of any office suite.
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
User avatar
Villeroy
Volunteer
 
Posts: 30079
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby rafael.alvamar » Thu Oct 29, 2020 11:12 am

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.
OpenOffice 4.1.17 on Windows 10
Java developer
rafael.alvamar
 
Posts: 7
Joined: Wed Oct 28, 2020 9:40 am

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

Postby rafael.alvamar » Thu Oct 29, 2020 11:18 am

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.
OpenOffice 4.1.17 on Windows 10
Java developer
rafael.alvamar
 
Posts: 7
Joined: Wed Oct 28, 2020 9:40 am

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

Postby Villeroy » Thu Oct 29, 2020 1:29 pm

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.
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
User avatar
Villeroy
Volunteer
 
Posts: 30079
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Postby UnklDonald418 » Thu Oct 29, 2020 6:04 pm

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
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.8 & LibreOffice 6.4.7.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1405
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

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

Postby rafael.alvamar » Thu Oct 29, 2020 8:02 pm

Wow you're awsome! Thanks a lot for your help. Now I have how start my study.
OpenOffice 4.1.17 on Windows 10
Java developer
rafael.alvamar
 
Posts: 7
Joined: Wed Oct 28, 2020 9:40 am


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest