Looking for tutorial UNO....

The Application Programming Interface and the OASIS Open Document Format

Looking for tutorial UNO....

Postby RobinDesHautbois » Mon Sep 10, 2012 10:30 pm

Hello,
I'm looking for a tutorial on the basics of populating an OpenOffice Writer document in a Java program. The template would be created directly in Open Office and the data would come from JDBC queries, that is, manipulated as POJO objects.

I found the following tutorial:
http://www.oooforum.org/forum/viewtopic.phtml?t=61386
but it is so complete, I have a hard time finding the basics..... I'm guessing I need to better learn the basics of ODF template writing in this scenario.

I took a look at JODReports, which looks really easy to use, but it seems limited and the website for its associated PDF writer (JODConverter) is not currently showing.

I'm mostly interested in:
1. Associating document parts (labels, table headers and cells, images, charts) with java-side variables.
2. Conditional content: e.g. show/hide a table (or nested table) only if there is actually data available.
3. Customizing the appearance (colors, background-images).

Any help on finding relevant tutorials is much appreciated!
OpenOffice.org 3.4.0
Ubuntu 12.04, gnome-shell (3.4.x) 64-bit
RobinDesHautbois
 
Posts: 1
Joined: Mon Sep 10, 2012 10:17 pm

Re: Looking for tutorial UNO....

Postby Hagar Delest » Mon Oct 01, 2012 2:17 pm

Because of no reply in Beginner section, moved to Macros>UNO sub-forum.
Perhaps some hints here: Documentation of OpenOffice BASIC objects, etc.
LibreOffice 7.2.1 on Xubuntu 21.04 and 7.2.1 portable on Windows 10
User avatar
Hagar Delest
Moderator
 
Posts: 29980
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Looking for tutorial UNO....

Postby jza » Sun Jan 20, 2013 10:35 am

this is a very 'basic' tutorial of OO in Java:
http://openofficejava.blogspot.mx/2009/ ... g-api.html

that said, have you seen the Python CreateTable example, it generates a document with tables and format and text and headings. I think is a much straight forward way of doing things.

Tools > Macros > Organize Macros > Python... then My Macros > Python > CreateTable

Looking at the code is pretty straightforward:
http://wiki.openoffice.org/wiki/PyUNO_s ... eSample.py

After the chunk of code, there is a breakdown with annotations.
AOO 4.1.1 on Arch Linux
User avatar
jza
 
Posts: 239
Joined: Mon Nov 03, 2008 11:33 am
Location: Cancún, Mexico

Re: Looking for tutorial UNO....

Postby Villeroy » Sun Jan 20, 2013 1:40 pm

IMHO, studying example snippets won't let you get the hang of it. UNO is too abstract for learning by doing.
As a fairly experienced programmer you need to know about the Frame-View-Model architecture, about UNO services and UNO interfaces.
With some knowledge about these general concepts, you get a better understanding of code snippets.
The MRI extension helps you to find any object, properties and methods for you. It does even generate code snippets while you are browsing the object hierarchy.
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: 30159
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Looking for tutorial UNO....

Postby jza » Sun Jan 20, 2013 10:15 pm

I missunderstood the situation, I thought you meant generate content in a document and you actually want to extract information from a document. This is a bit more tricky specially since you will need to query the document for active objects, which is what a code inspector. to understand what is active, althought MRI is great, I am not sure how can you automate the query of objects. Maybe some smarter algorithm that can validate the active objects in the current document and decide if it can proceed with reading the content of the document.

I also not sure how can you retrieve the actual text content from an object. AFAIK objects are used to execute instructions but not to hold document data.
AOO 4.1.1 on Arch Linux
User avatar
jza
 
Posts: 239
Joined: Mon Nov 03, 2008 11:33 am
Location: Cancún, Mexico


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 3 guests