Examples of OdfTextParagraph


Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

      String filePath = ResourceUtilities.getAbsolutePath("headerFooterHidden.odt");
      File file = new File(filePath);
      TextDocument tdocument = TextDocument.loadDocument(file);
      Assert.assertNotNull(tdocument);
      //Paragraph textParagraph1 = tdocument.addParagraph("Paragraph1");
      OdfTextParagraph textParagraph = tdocument.addText("text1");
     
      Assert.assertEquals("text1", textParagraph.getTextContent());
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

  @Test
  public void testReturnChar() {
    try {
      TextDocument textDoc = TextDocument.newTextDocument();
      textDoc.newParagraph();
      OdfTextParagraph graph = textDoc.newParagraph("abc");

      TextExtractor extractor = TextExtractor.newOdfTextExtractor(textDoc.getContentRoot());
      String text = extractor.getText();
      System.out.println(text);
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

   * @deprecated As of Simple version 0.5, replaced by
   *             <code>addParagraph(String text)</code>
   * @see #addParagraph(String)
   */
  public OdfTextParagraph newParagraph(String text) throws Exception {
    OdfTextParagraph para = newParagraph();
    para.addContent(text);
    return para;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

   * @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();
    }
    para.addContent(text);
    return para;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

      content = "";
    }
    removeContent();

    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    OdfTextParagraph para = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
    textProcessor.append(para, content);

    mCellElement.appendChild(para);
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

      content = "";
    }
    removeContent();

    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    OdfTextParagraph para = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
    if ((stylename != null) && (stylename.length() > 0)) {
      para.setStyleName(stylename);
    }
    textProcessor.append(para, content);

    mCellElement.appendChild(para);
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

      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.incubator.doc.text.OdfTextParagraph

  private void setDisplayTextContent(String content, String stylename) {
    WhitespaceProcessor textProcessor = new WhitespaceProcessor();
    OdfStylableElement element = OdfElement.findFirstChildNode(OdfTextParagraph.class, mCellElement);
    if (element == null) {
      removeContent();
      element = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
      mCellElement.appendChild(element);
    } else {
      String formerContent = element.getTextContent();
      while (formerContent == null || "".equals(formerContent)) {
        OdfTextSpan span = OdfElement.findFirstChildNode(OdfTextSpan.class, element);
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

  private void setDisplayTextContent(String content, String stylename) {
    WhitespaceProcessor textProcessor = new WhitespaceProcessor();
    OdfStylableElement element = OdfElement.findFirstChildNode(OdfTextParagraph.class, mCellElement);
    if (element == null) {
      removeContent();
      element = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
      mCellElement.appendChild(element);
    } else {
      String formerContent = element.getTextContent();
      while (formerContent == null || "".equals(formerContent)) {
        OdfTextSpan span = OdfElement.findFirstChildNode(OdfTextSpan.class, element);
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfTextParagraph

  public void testReplaceWithConditionField() {
    try {
      search = new TextNavigation("ReplaceConditionTarget", doc);
      // declare simple variable
      VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_con_variable");
      OdfTextParagraph varParagraph = doc.newParagraph("test_con_variable:");
      simpleVariableField.updateField("true", varParagraph);
      // count the initial date field count.
      OdfContentDom contentDom = doc.getContentDom();
      NodeList nodeList = contentDom.getElementsByTagName(TextConditionalTextElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
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.