I'm finding the OpenOffice.org 1.1 Developer's Guide worth its weight in gold (and since it comes at 1047 pages, that's probably a fair amount of gold). A lot of the text formatting of the "Contacts Report" title is extrapolated from page 55 of the Developer's Guide. To learn about tables, with good code samples including a very good line-by-line explanation, start at page 490. Halfway down page 473 is a table entitled "Properties of com.sun.star.style.CharacterProperties", which is very useful (and would be even more useful if the properties were listed alphabetically).
Here's a little look into how the "Contacts Report" title (shown in the screenshot above) is constructed. What allows us to format text is the cursor—as you move it along the text, you can tell it how to format the text it encounters.
//First, create an object that represents the entire text:
com.sun.star.text.XText xText = xTextDocument.getText();
//Next, create a text cursor (there are various other types too) for selecting and formatting:
XTextCursor xTCursor = xText.createTextCursor();
//Next, create a property set to store all the properties you're going to set:
XPropertySet xCursorProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTCursor);
//Select 15 characters, which is the length of "Contacts Report":
//Now, set Italics...
xCursorProps.setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD));
//...cool shadowy effect thingy...
//Finally, add the text itself, adding some tabs for indentation and a linebreak at the end:
One annoying thing is that CharColor uses ARGB notation. Or just a plain number. I mean, until I trawled through the Developer's Guide, I had no idea that the color blue is represented by the number 255 (and white is 16777215, while black is 65536). I'd much prefer it if I could use this instead:
Another unfortunate thing is that, as you can see, all the properties are identified as Strings, so code completion doesn't help at all. You can't put your cursor, in the IDE, after Char in the line above and then call up code completion when you're thinking about other properties to use. (That's where the table referred to earlier comes in handy, because code completion doesn't.) For example, I expected there to be a property called CharSize, and spent about half an hour discovering that it is called CharHeight instead.
And, hurray, as you can see, I managed to get the whole JTable from my NetBeans Platform application into the table in the OpenOffice.org Writer document! Yesterday I only showed one column because... that's the only part of the table I managed to get into the Writer document. The way I got the whole table in there seems a bit convoluted, which is something else I need to work on.