Examples of TextPElement


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

    if (annotation == null) {
      OdfFileDom dom = (OdfFileDom) mCellElement.getOwnerDocument();
      annotation = (OfficeAnnotationElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
          OdfDocumentNamespace.OFFICE, "annotation"));
    }
    TextPElement noteElement = OdfElement.findFirstChildNode(TextPElement.class, annotation);
    if (noteElement == null) {
      noteElement = annotation.newTextPElement();
    }
    noteElement.setTextContent(note);
    DcCreatorElement dcCreatorElement = OdfElement.findFirstChildNode(DcCreatorElement.class, annotation);
    if (dcCreatorElement == null) {
      dcCreatorElement = annotation.newDcCreatorElement();
    }
    dcCreatorElement.setTextContent(System.getProperty("user.name"));
View Full Code Here

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

      if (mOwnerTable.mIsSpreadsheet) {
        newImage = Image.newImage(this, imageUri);
      } else {
        OdfFileDom dom = (OdfFileDom) mCellElement.getOwnerDocument();
        TextPElement pElement = dom.newOdfElement(TextPElement.class);
        mCellElement.appendChild(pElement);
        newImage = Image.newImage(Paragraph.getInstanceof(pElement), imageUri);
      }
      if (imageUri != null) {
        FrameRectangle rect = newImage.getRectangle();
View Full Code Here

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

   * @since 0.4.5
   * @deprecated
   */
  public BufferedImage getBufferedImage() {
    try {
      TextPElement pElement = OdfElement.findFirstChildNode(TextPElement.class, mCellElement);
      if (pElement != null) {
        DrawFrameElement drawFrame = OdfElement.findFirstChildNode(DrawFrameElement.class, pElement);
        if (drawFrame != null) {
          DrawImageElement imageElement = OdfElement.findFirstChildNode(DrawImageElement.class, drawFrame);
          if (imageElement != null) {
View Full Code Here

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

   *         {@link org.odftoolkit.simple.draw.Image Image} will be returned.
   * @since 0.5.5
   */
  public Image getImage() {
    try {
      TextPElement pElement = OdfElement.findFirstChildNode(TextPElement.class, mCellElement);
      if (pElement != null) {
        DrawFrameElement drawFrame = OdfElement.findFirstChildNode(DrawFrameElement.class, pElement);
        if (drawFrame != null) {
          DrawImageElement imageElement = OdfElement.findFirstChildNode(DrawImageElement.class, drawFrame);
          return Image.getInstanceof(imageElement);
View Full Code Here

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

    // http://www.w3.org/TR/xpath#path-abbrev)
    XPath xpath2 = odfContent.getXPath();

    // receiving the first paragraph "//text:p[1]" ''(JDK5
    // functionality)''
    TextPElement para = (TextPElement) xpath2.evaluate("//text:p[1]", odfContent, XPathConstants.NODE);

    // adding an image - expecting the user to know that
    // an image consists always of a 'draw:image' and a 'draw:frame'
    // parent

    // 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

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

      OdfContentDom contentDom = embDoc.getContentDom();
      XPath xpath = contentDom.getXPath();
      // Make sure the embedded document is being loaded

      // 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);

      // Access/Update automatic styles
      OdfOfficeAutomaticStyles autoStyles = embDoc.getContentDom().getAutomaticStyles();
      OdfStyle autoStyle = autoStyles.getStyle("P1", OdfStyleFamily.Paragraph);
View Full Code Here

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

      Assert.assertNotNull(fileEntry);

      // get "Object 1/content.xml"
      OdfContentDom contentDom = embDoc.getContentDom();
      XPath xpath = contentDom.getXPath();
      TextPElement lastPara = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
      addFrameForEmbeddedDoc(contentDom, lastPara, "Object in Object1");
      List<Document> emb_embDocs = embDoc.getEmbeddedDocuments();
      Assert.assertEquals(embDocsNumber + 1, emb_embDocs.size());

      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

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

      Document doc1 = embDocs.get(0);
      Assert.assertNotNull(doc1);

      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();
      OdfTextSpan span = (OdfTextSpan) xpath.evaluate("//text:span[last()]", contentDom2, XPathConstants.NODE);
      Assert.assertEquals(span.getTextContent(), TEST_SPAN_TEXT);
      List<Document> embDocs3 = docWithEmbeddedObjects.getEmbeddedDocuments(Document.OdfMediaType.TEXT);

      // Writer Doc
      Document doc3 = embDocs3.get(0);
      Assert.assertNotNull(doc3);
      OdfContentDom contentDom3 = doc3.getContentDom();
      TextPElement para2 = (TextPElement) xpath.evaluate("//text:p[1]", contentDom3, XPathConstants.NODE);
      addImageToDocument(contentDom3, para2);
      TextPElement para3 = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom3, XPathConstants.NODE);
      addFrameForEmbeddedDoc(contentDom3, para3, "NewEmbedded");
      doc3.insertDocument(TextDocument.newTextDocument(), "/NewEmbedded/");
      Document doc4 = doc3.getEmbeddedDocument("NewEmbedded");
      Assert.assertNotNull(doc4);
      OdfContentDom contentDom4 = doc4.getContentDom();
View Full Code Here

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

   */
  public static Paragraph newParagraph(ParagraphContainer container) {
    Paragraph para = null;
    OdfElement parent = container.getParagraphContainerElement();
    OdfFileDom ownerDom = (OdfFileDom) parent.getOwnerDocument();
    TextPElement pEle = ownerDom.newOdfElement(TextPElement.class);
    parent.appendChild(pEle);
    para = new Paragraph(pEle);
    Component.registerComponent(para, pEle);

    return para;
View Full Code Here

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

    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();
    } else if (dom instanceof OdfStylesDom) {
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.