odftoolkit - Setting style on a paragraph using ODF toolkit simple-odf.0.8.1 -


this question has been asked member in octobre 2014, incubating simple-odf.0.8.1 not seem solve problem.

i'm trying generate odf text document (*.odt), applying styles newly generated paragraphs. when opening generated document libreoffice 5, newly generated paragraphs appear default style , not wanted one.

am doing wrong or there an, yet, not corrected bug ?

import java.io.fileoutputstream;  import org.odftoolkit.odfdom.dom.style.odfstylefamily; import org.odftoolkit.odfdom.incubator.doc.office.odfofficestyles; import org.odftoolkit.odfdom.incubator.doc.style.odfstyle; import org.odftoolkit.simple.textdocument; import org.odftoolkit.simple.text.paragraph;  public class test {      public static void main(string[] args) {          try {              // loading template document styles             textdocument doc = (textdocument)textdocument.loaddocument("template.odt");              // checking if "mystyle" included             odfofficestyles styles = doc.getorcreatedocumentstyles();             (odfstyle e : styles.getstylesforfamily(odfstylefamily.paragraph)) {                 system.out.println(e.getstylenameattribute());             }              // adding styled paragraph, first way             paragraph paragraph = doc.addparagraph("text before setting style");             paragraph.setstylename("mystyle");              // adding styled paragraph, other way sure             paragraph = doc.addparagraph("");             paragraph.setstylename("mystyle");             paragraph.settextcontent("text after setting style");              // saving result             doc.save(new fileoutputstream("result.odt"));             system.out.println("saved");         } catch (exception ex) {             system.err.println("ex=" + ex.getmessage());         }     } } 


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -