Examples of TextPElement


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

      frame.setSvgWidthAttribute("7in");
      DrawImageElement image = contentDom.newOdfElement(DrawImageElement.class);
      image.setXlinkHrefAttribute("Pictures/myHoliday.jpg");
      frame.appendChild(image);

      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      para.appendChild(frame);
      doc.save(TEST_FILE_FOLDER + New_File);
      doc.close();

      //Test if the image has been inserted
      doc = OdfDocument.loadDocument(TEST_FILE_FOLDER + New_File);
View Full Code Here

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

  @Test
  public void testCellReplacementWithParagraph() throws Exception {
    replace(new ReplacementAction() {

      public void replace(TextSelection selection, String value) throws Exception {
        TextParagraphElementBase paragraphElement = new TextPElement(doc.getContentDom());
        Paragraph para = Paragraph.getInstanceof(paragraphElement);
        para.setTextContent(value);
        selection.replaceWith(para);
      }
    });
View Full Code Here

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

    if(frameList.getLength() > 0){
      DrawFrameElement frame = (DrawFrameElement)frameList.item(0);
      NodeList textBoxList = frame.getElementsByTagNameNS(OdfDocumentNamespace.DRAW.getUri(), "text-box");
      if(textBoxList.getLength() > 0){
        DrawTextBoxElement textBox = (DrawTextBoxElement)textBoxList.item(0);
        TextPElement newPara = textBox.newTextPElement();
        newPara.setTextContent(text);
      }
    }
  }
View Full Code Here

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

        TableTableRowElement aRow = (TableTableRowElement) OdfXMLFactory.newOdfElement(dom,
            OdfName.newName(OdfDocumentNamespace.TABLE, "table-row"));
        for (int j = 0; j < numCols; j++) {
          TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom,
              OdfName.newName(OdfDocumentNamespace.TABLE, "table-cell"));
          TextPElement aParagraph = (TextPElement) OdfXMLFactory.newOdfElement(dom,
              OdfName.newName(OdfDocumentNamespace.TEXT, "p"));
          aCell.appendChild(aParagraph);
          if (!isSpreadsheet) {
            if ((j + 1 == numCols) && (i == 0)) {
              aCell.setStyleName(righttopStyle.getStyleNameAttribute());
            } else if (i == 0) {
              aCell.setStyleName(lefttopStyle.getStyleNameAttribute());
            } else if ((j + 1 == numCols) && (i > 0)) {
              aCell.setStyleName(rightbottomStyle.getStyleNameAttribute());
            } else {
              aCell.setStyleName(leftbottomStyle.getStyleNameAttribute());
            }
          }
          aRow.appendChild(aCell);
        }
        headerrows.appendChild(aRow);
      }
      newTEle.appendChild(headerrows);
    }

    //3.2 create common row elements
    for (int i = headerRowNumber; i < numRows; i++) {
      TableTableRowElement aRow = (TableTableRowElement) OdfXMLFactory.newOdfElement(dom,
          OdfName.newName(OdfDocumentNamespace.TABLE, "table-row"));
      for (int j = 0; j < numCols; j++) {
        TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom,
            OdfName.newName(OdfDocumentNamespace.TABLE, "table-cell"));
        TextPElement aParagraph = (TextPElement) OdfXMLFactory.newOdfElement(dom,
            OdfName.newName(OdfDocumentNamespace.TEXT, "p"));
        aCell.appendChild(aParagraph);
        if (!isSpreadsheet) {
          if ((j + 1 == numCols) && (i == 0)) {
            aCell.setStyleName(righttopStyle.getStyleNameAttribute());
View Full Code Here

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

    TableTableRowElement aRow = (TableTableRowElement) OdfXMLFactory.newOdfElement(dom,
        OdfName.newName(OdfDocumentNamespace.TABLE, "table-row"));
    for (int j = 0; j < columnCount; j++) {
      TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom,
          OdfName.newName(OdfDocumentNamespace.TABLE, "table-cell"));
      TextPElement aParagraph = (TextPElement) OdfXMLFactory.newOdfElement(dom,
          OdfName.newName(OdfDocumentNamespace.TEXT, "p"));
      aCell.appendChild(aParagraph);
      if (!mIsSpreadsheet) {
        if (j + 1 == columnCount) {
          aCell.setStyleName(righttopStyle.getStyleNameAttribute());
View Full Code Here

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

        TableTableCellElement lastCell = (TableTableCellElement) xpath.evaluate("//table:table-cell[last()]", contentDom, XPathConstants.NODE);
        lastCell.appendChild(drawFrame);
        drawFrame.removeAttribute("text:anchor-type");

      } else if (this instanceof OdfTextDocument) {
        TextPElement lastPara = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
        if (lastPara == null) {
          lastPara = ((OdfTextDocument) this).newParagraph();
        }
        lastPara.appendChild(drawFrame);
        drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      } else if (this instanceof OdfPresentationDocument) {
        DrawPageElement lastPage = (DrawPageElement) xpath.evaluate("//draw:page[last()]", contentDom, XPathConstants.NODE);
        lastPage.appendChild(drawFrame);
      }
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.