Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
0.6.1-incubating
-
None
-
None
Description
The setStyleName method on the Paragraph class in the SimpleAPI doesn't appear to do anything. In my case I have been trying to set a style that was preconfigured in a template. I have just checked, and a style that was set in code appears to do the same.
Here's a short snippet.
public static void main(String[] args) throws Exception { TextDocument odt = TextDocument.newTextDocument(); OdfOfficeStyles s = odt.getOrCreateDocumentStyles(); OdfStyle veryRed = s.newStyle("Very_red", OdfStyleFamily.Paragraph); veryRed.setProperty(OdfParagraphProperties.BackgroundColor, "#ff0000"); // Create a paragraph Paragraph p1 = odt.addParagraph("Blah."); // I think these two lines are supposed to be equivalent, however, // when you comment out the first one, the style is lost. p1.getOdfElement().setStyleName("Very_red"); p1.setStyleName("Very_red"); // Save the file odt.save("result.odt"); }
I looked into how to fix this, and I think it might be as simple as changing a few lines in Paragraph's constructor. But I don't really feel comfortable doing it seeing as I have only been using this library for a few days.