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

Examples of org.odftoolkit.odfdom.dom.element.text.TextPElement.appendChild()


        TextPElement lastPara = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom,
            XPathConstants.NODE);
        if (lastPara == null) {
          lastPara = ((TextDocument) this).newParagraph();
        }
        lastPara.appendChild(drawFrame);
        drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      } else if (this instanceof PresentationDocument) {
        DrawPageElement lastPage = (DrawPageElement) xpath.evaluate("//draw:page[last()]", contentDom,
            XPathConstants.NODE);
        lastPage.appendChild(drawFrame);
View Full Code Here


    protected DrawFrameElement getChartFrame() throws Exception {
      OdfContentDom contentDom2 = sdoc.getContentDom();
      DrawFrameElement drawFrame = contentDom2.newOdfElement(DrawFrameElement.class);
      TextPElement lastPara = sdoc.getContentRoot().newTextPElement();
      lastPara.appendChild(drawFrame);
      drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      return drawFrame;
    }
  }
}
View Full Code Here

      // FUTURE USAGE: para.createDrawFrame().createDrawImage("/myweb.org/images/myHoliday.png", "/Pictures/myHoliday.png");
      //             Child access methods are still not part of the v0.6.x releases
      // CURRENT USAGE:
      OdfDrawFrame odfFrame = (OdfDrawFrame) OdfXMLFactory.newOdfElement(odfContent, DrawFrameElement.ELEMENT_NAME);
      para.appendChild(odfFrame);
      OdfDrawImage odfImage = (OdfDrawImage) OdfXMLFactory.newOdfElement(odfContent, OdfDrawImage.ELEMENT_NAME);
      odfFrame.appendChild(odfImage);
      odfImage.newImage(ResourceUtilities.getURI(TEST_PIC));

      OdfDrawImage odfImage2 = (OdfDrawImage) OdfXMLFactory.newOdfElement(odfContent, OdfDrawImage.ELEMENT_NAME);
View Full Code Here

      // Add text element
      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      LOG.log(Level.INFO, "First para: {0}", para.getTextContent());
      OdfTextSpan spanElem = new OdfTextSpan(contentDom);
      spanElem.setTextContent(TEST_SPAN_TEXT);
      para.appendChild(spanElem);

      // Add frame and image element
      TextPElement paraLast = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
      addImageToDocument(contentDom, paraLast);
View Full Code Here

      OdfDocument emb_embDoc = rootDocument.loadSubDocument(embDoc.getDocumentPath()+ pathOfSecondInnerDoc);
      contentDom = emb_embDoc.getContentDom();
      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      OdfTextSpan spanElem = new OdfTextSpan(contentDom);
      spanElem.setTextContent(TEST_SPAN_TEXT);
      para.appendChild(spanElem);

      // embDoc.save(ResourceUtilities.newTestOutputFile("222debug.odt"));
      rootDocument.save(TEST_FILE_EMBEDDED_EMBEDDED);

      OdfDocument docWithdoubleEmbeddedDoc = OdfDocument.loadDocument(TEST_FILE_EMBEDDED_EMBEDDED);
View Full Code Here

        OdfContentDom contentDom = doc1.getContentDom();
        XPath xpath = contentDom.getXPath();
        TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
        OdfTextSpan spanElem = new OdfTextSpan(contentDom);
        spanElem.setTextContent(TEST_SPAN_TEXT);
        para.appendChild(spanElem);
        //save the embed document to a stand alone document
        doc1.save(TEST_FILE_SAVE_EMBEDDED_OUT);
        // Load test
        OdfDocument loadedDoc = OdfDocument.loadDocument(TEST_FILE_SAVE_EMBEDDED_OUT);
        OdfContentDom contentDom2 = loadedDoc.getContentDom();
View Full Code Here

    // "/Pictures/myHoliday.png");
    // Child access methods are still not part of the v0.6.x releases
    // CURRENT USAGE:
    OdfDrawFrame odfFrame = (OdfDrawFrame) OdfXMLFactory.newOdfElement(odfContent,
        DrawFrameElement.ELEMENT_NAME);
    para.appendChild(odfFrame);
    OdfDrawImage odfImage = (OdfDrawImage) OdfXMLFactory.newOdfElement(odfContent, OdfDrawImage.ELEMENT_NAME);
    odfFrame.appendChild(odfImage);
    odfImage.newImage(ResourceUtilities.getURI(TEST_PIC));

    OdfDrawImage odfImage2 = (OdfDrawImage) OdfXMLFactory.newOdfElement(odfContent, OdfDrawImage.ELEMENT_NAME);
View Full Code Here

      // Add text element
      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      LOG.log(Level.INFO, "First para: {0}", para.getTextContent());
      OdfTextSpan spanElem = new OdfTextSpan(contentDom);
      spanElem.setTextContent(TEST_SPAN_TEXT);
      para.appendChild(spanElem);

      // Add frame and image element
      TextPElement paraLast = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
      addImageToDocument(contentDom, paraLast);
View Full Code Here

      Document emb_embDoc = rootDocument.getEmbeddedDocument(embDoc.getDocumentPath() + pathOfSecondInnerDoc);
      contentDom = emb_embDoc.getContentDom();
      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      OdfTextSpan spanElem = new OdfTextSpan(contentDom);
      spanElem.setTextContent(TEST_SPAN_TEXT);
      para.appendChild(spanElem);

      // embDoc.save(ResourceUtilities.newTestOutputFile("222debug.odt"));
      rootDocument.save(TEST_FILE_EMBEDDED_EMBEDDED);

      Document docWithdoubleEmbeddedDoc = Document.loadDocument(TEST_FILE_EMBEDDED_EMBEDDED);
View Full Code Here

      OdfContentDom contentDom = doc1.getContentDom();
      XPath xpath = contentDom.getXPath();
      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      OdfTextSpan spanElem = new OdfTextSpan(contentDom);
      spanElem.setTextContent(TEST_SPAN_TEXT);
      para.appendChild(spanElem);
      // save the embed document to a stand alone document
      doc1.save(TEST_FILE_SAVE_EMBEDDED_OUT);
      // Load test
      Document loadedDoc = Document.loadDocument(TEST_FILE_SAVE_EMBEDDED_OUT);
      OdfContentDom contentDom2 = loadedDoc.getContentDom();
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.