Package org.odftoolkit.odfdom.dom.element.office

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeAnnotationElement


   * Child element is new in Odf 1.2
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here


     
      Paragraph paragraph = newDoc.addParagraph("Paragraph1");
      paragraph.addComment("This is a comment for Paragraph1", "Simple ODF");
      Node firstChildNode = paragraph.getOdfElement().getFirstChild();
      Assert.assertTrue(firstChildNode instanceof OfficeAnnotationElement);
      OfficeAnnotationElement comment = (OfficeAnnotationElement) firstChildNode;
      Assert.assertEquals("Simple ODF", comment.getFirstChild().getTextContent());
      Assert.assertEquals("This is a comment for Paragraph1", comment.getLastChild().getTextContent());
      Assert.assertTrue(firstChildNode instanceof OfficeAnnotationElement);
     
      paragraph = newDoc.addParagraph("Paragraph2");
      paragraph.addComment("This is a comment for Paragraph2", null);
      firstChildNode = paragraph.getOdfElement().getFirstChild();
      Assert.assertTrue(firstChildNode instanceof OfficeAnnotationElement);
      comment = (OfficeAnnotationElement) firstChildNode;
      Assert.assertEquals(System.getProperty("user.name"), comment.getFirstChild().getTextContent());
      Assert.assertEquals("This is a comment for Paragraph2", comment.getLastChild().getTextContent());
     
      newDoc.save(ResourceUtilities.newTestOutputFile("AddCommentOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(TextDocumentTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail();
View Full Code Here

      throw new InvalidNavigationException("No matched string at this position");
    }
    // create annotation element
    OdfElement parentElement = getContainerElement();
    OdfFileDom dom = (OdfFileDom) parentElement.getOwnerDocument();
    OfficeAnnotationElement annotationElement = dom.newOdfElement(OfficeAnnotationElement.class);
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
    if (creator == null) {
      creator = System.getProperty("user.name");
    }
    dcCreatorElement.setTextContent(creator);
    // set date
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = annotationElement.newDcDateElement();
    dcDateElement.setTextContent(dcDate);
    TextPElement notePElement = annotationElement.newTextPElement();
    TextSpanElement noteSpanElement = notePElement.newTextSpanElement();
    // set comment style
    OdfOfficeAutomaticStyles styles = null;
    if (dom instanceof OdfContentDom) {
      styles = ((OdfContentDom) dom).getAutomaticStyles();
View Full Code Here

   * Create child element {@odf.element office:annotation}.
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

   * Create child element {@odf.element office:annotation}.
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

   * Create child element {@odf.element office:annotation}.
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

   * Create child element {@odf.element office:annotation}.
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

   * Child element is new in Odf 1.2
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

   * Create child element {@odf.element office:annotation}.
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

   * Create child element {@odf.element office:annotation}.
   *
   * @return the element {@odf.element office:annotation}
   */
  public OfficeAnnotationElement newOfficeAnnotationElement() {
    OfficeAnnotationElement officeAnnotation = ((OdfFileDom) this.ownerDocument).newOdfElement(OfficeAnnotationElement.class);
    this.appendChild(officeAnnotation);
    return officeAnnotation;
  }
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.office.OfficeAnnotationElement

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.