Hi-
If you can't find what you need in the Simple API, you can also use the
lower level API (DOM).
See https://incubator.apache.org/odftoolkit/odfdom/Layers.html
I find it useful to create an example document in OpenOffice, save it,
then unzip the *.odt.
Look at content.xml for the XML tags that are being used.
That should give you hints on where to find it (odfdom.dom.text.*)
You can also create your own styles something like this:
OdfStyle style;
style = contentAutoStyles.newStyle(OdfStyleFamily.Paragraph);
style.setStyleNameAttribute("P3");
style.setProperty(StyleTextPropertiesElement.FontName, "Arial");
style.setProperty(StyleTextPropertiesElement.FontWeight, "bold");
style.setProperty(StyleTextPropertiesElement.FontSize, "10pt");
style.setProperty(StyleTextPropertiesElement.FontSizeAsian, "10pt");
style.setProperty(StyleTextPropertiesElement.FontSizeComplex, "10pt");
then use:
TableTableElement tte;
tte = new TableTableElement(contentDom);
tte.setStyleName("P3");
This was for use in a table, but I'm sure text is similar.
Fred
On 3/3/2016 1:20 PM, Peter Cernocky wrote:
Hi Svante,
thx for replying, I appreciate.
My approach is different. I'm creating odf file from the scratch in
Java code. Let me clarify:
1.
/TextDocument outputOdt = TextDocument.newTextDocument();/
/Paragraph paragraph = outputOdt.addParagraph("First ");//
//paragraph.appendTextContent("Second ");//
//paragraph.appendTextContent("Third");/
Here, I want only word "Second" (all words are in one line - like
sentence) to be bold font. I can find in API only:
/paragraph.setFont(/ /new Font("Arial", BOLD, 10));/
- but this one will set the whole paragraph to bold:(
2.
Also hyperlink, like:
/p2.appendHyperlink("Hello", new URI("http://..."));///does not seems
to "support" font settings.
But I think if I get to know how to fix my first problem, this
hyperlink problem will be gone, too.
Thanks for any kind of reply.
Peto