Examples of OfficeTextElement


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

   *             <code>Paragraph.newParagraph(ParagraphContainer)</code>
   * @see Paragraph#newParagraph(ParagraphContainer)
   * @see #addParagraph(String)
   */
  public OdfTextParagraph newParagraph() throws Exception {
    OfficeTextElement odfText = getContentRoot();
    return (OdfTextParagraph) odfText.newTextPElement();
  }
View Full Code Here

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

   * @see Paragraph#appendTextContentNotCollapsed(String)
   * @see #getParagraphByIndex(int, boolean)
   * @see #getParagraphByReverseIndex(int, boolean)
   */
  public OdfTextParagraph addText(String text) throws Exception {
    OfficeTextElement odfText = getContentRoot();
    Node n = odfText.getLastChild();
    OdfTextParagraph para;
    if (OdfTextParagraph.class.isInstance(n)) {
      para = (OdfTextParagraph) n;
    } else {
      para = newParagraph();
View Full Code Here

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

      if (isForeignNode) // not in a same document
        newSectionEle = (TextSectionElement) cloneForeignElement(newSectionEle, getContentDom(), true);

      updateNames(newSectionEle);
      updateXMLIds(newSectionEle);
      OfficeTextElement contentRoot = getContentRoot();
      contentRoot.appendChild(newSectionEle);
      return Section.getInstance(newSectionEle);
    } catch (Exception e) {
      Logger.getLogger(TextDocument.class.getName()).log(Level.SEVERE, null, e);
    }
    return null;
View Full Code Here

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

      OdfStyle style = styles.newStyle(OdfStyleFamily.Paragraph);
      style.newStyleParagraphPropertiesElement().setFoBreakBeforeAttribute(breakAttribute);
      if(refParagraph == null){
        pEle = getContentRoot().newTextPElement();
      } else {
        OfficeTextElement contentRoot = getContentRoot();
        pEle = contentRoot.newTextPElement();
        OdfElement refEle = refParagraph.getOdfElement();
        contentRoot.insertBefore(pEle, refEle.getNextSibling());
      }
      pEle.setStyleName(style.getStyleNameAttribute());
    } catch (Exception e) {
      Logger.getLogger(TextDocument.class.getName()).log(Level.SEVERE, null, e);
      throw new RuntimeException(breakAttribute + "Break appends failed.", e);
View Full Code Here

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

      OdfDrawFrame frame1 = (OdfDrawFrame) image.getParentNode();
      frame1.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PAGE.toString());
      frame1.setTextAnchorPageNumberAttribute(1);

      //add paragraph
      OfficeTextElement office = doc.getContentRoot();
      OdfTextParagraph para1 = (OdfTextParagraph) office.newTextPElement();
      para1.setTextContent("insert an image here");
      String imagePath2 = doc.newImage(mImageUri_ODFDOM);

      OdfTextParagraph para2 = (OdfTextParagraph) office.newTextPElement();
      para2.setTextContent("another");
      String imagePath3 = doc.newImage(mImageUri_ODFDOM);
      OdfDrawImage image3 = getImageByPath(doc, imagePath3).get(1);
      OdfDrawFrame frame3 = (OdfDrawFrame) image3.getParentNode();
      frame3.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.CHAR.toString());
View Full Code Here

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

   *
   * @return The new paragraph
   * @throws Exception if the file DOM could not be created.
   */
  public OdfTextParagraph newParagraph() throws Exception {
    OfficeTextElement odfText = getContentRoot();
    return (OdfTextParagraph) odfText.newTextPElement();
  }
View Full Code Here

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

   * @param text initial text for the paragraph.
   * @return The paragraph at the end of the text document, where the text has been added to.
   * @throws Exception if the file DOM could not be created.
   */
  public OdfTextParagraph addText(String text) throws Exception {
    OfficeTextElement odfText = getContentRoot();
    Node n = odfText.getLastChild();
    OdfTextParagraph para;
    if (OdfTextParagraph.class.isInstance(n)) {
      para = (OdfTextParagraph) n;
    } else {
      para = newParagraph();
View Full Code Here

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

    // Load file
    OdfTextDocument odt = (OdfTextDocument) OdfDocument.loadDocument("ImageIn.odt");

    // get root of all content of a text document
    OfficeTextElement officeText = odt.getContentRoot();

    // get first paragraph
    TextPElement firstParagraph =
      OdfElement.findFirstChildNode(TextPElement.class, officeText);
View Full Code Here

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

  private class FormContainerImpl extends AbstractFormContainer {

    public OfficeFormsElement getFormContainerElement() {
      OfficeFormsElement forms = null;
      try {
        OfficeTextElement root = getContentRoot();
        forms = OdfElement.findFirstChildNode(OfficeFormsElement.class,
            root);
        if (forms == null) {
          Node firstChild = root.getFirstChild();
          OfficeFormsElement officeForms = ((OdfFileDom) getContentDom())
              .newOdfElement(OfficeFormsElement.class);
          forms = (OfficeFormsElement) root.insertBefore(officeForms,
              firstChild);
        }
        return forms;
      } catch (Exception e) {
        Logger.getLogger(TextDocument.class.getName()).log(
View Full Code Here

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

    OdfElement rightparentElement = textSelection.getContainerElement();
    int nodeLength = TextExtractor.getText(rightparentElement).length();
    Paragraph orgparagraph = Paragraph.getInstanceof((TextParagraphElementBase) rightparentElement);
   
    TextDocument document = (TextDocument) orgparagraph.getOwnerDocument();
    OfficeTextElement sroot = sourceDocument.getContentRoot();
    NodeList clist = sroot.getChildNodes();
   
    try {
      OfficeTextElement documentRoot = document.getContentRoot();
      Node rootNode = rightparentElement.getParentNode();
      if (!rootNode.equals(documentRoot)) {
        throw new RuntimeException(
            "The ParentNode of text content's ContainerElement which will be replaced is not Document ContentRoot, TextDocument only can be insert to the Docuemnt ContentRoot");
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.