Package org.odftoolkit.odfdom.dom.element.text

Examples of org.odftoolkit.odfdom.dom.element.text.TextTimeElement


    try {
      TextDocument doc = TextDocument.newTextDocument();
      TimeField timeField = Fields.createTimeField(doc.newParagraph("Time:"));
      Assert.assertNotNull(timeField);

      TextTimeElement timeEle = timeField.getOdfElement();
      String oldContent = timeEle.getTextContent();
      SimpleDateFormat oldFormat = new SimpleDateFormat("HH:mm:ss");
      Date oldDate = oldFormat.parse(oldContent);

      String format = "HH:mm:ss a";
      timeField.formatTime(format);
      String newContent = timeEle.getTextContent();
      SimpleDateFormat newFormat = new SimpleDateFormat(format);
      Date newDate = newFormat.parse(newContent);
      Assert.assertEquals(oldDate.getTime(), newDate.getTime());
    } catch (Exception e) {
      Logger.getLogger(FieldsTest.class.getName()).log(Level.SEVERE, null, e);
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.text.TextTimeElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.