Examples of OdfTextParagraph


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

    LOG.info("append");
    Element element = null;
    WhitespaceProcessor instance = new WhitespaceProcessor();
    int i;
    for (i = 0; i < plainText.length; i++) {
      element = new OdfTextParagraph(dom);
      instance.append(element, plainText[i]);
      compareResults(element, plainText[i], elementResult[i]);
    }
  }
View Full Code Here

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

    WhitespaceProcessor instance = new WhitespaceProcessor();
    int i;
    String expResult = "";
    String result;
    for (i = 0; i < plainText.length; i++) {
      element = new OdfTextParagraph(dom);
      constructElement(element, elementResult[i]);
      result = plainText[i];
      expResult = instance.getText(element);
      Assert.assertEquals(expResult, result);
    }
View Full Code Here

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

  public void testAppendText() {
    LOG.info("appendText");
    Element element = null;
    int i;
    for (i = 0; i < plainText.length; i++) {
      element = new OdfTextParagraph(dom);
      WhitespaceProcessor.appendText(element, plainText[i]);
      compareResults(element, plainText[i], elementResult[i]);
    }
  }
View Full Code Here

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

    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(TEST_DOCUMENT));

      // declare simple variable
      VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_con_variable");
      OdfTextParagraph varParagraph = doc.newParagraph("test_con_variable:");
      simpleVariableField.updateField("true", varParagraph);

      // test condition field
      OdfTextParagraph newParagraph = doc.newParagraph("Condition Field Test:");
      ConditionField conditionField = Fields.createConditionField(newParagraph, "test_con_variable == \"true\"",
          "trueText", "falseText");
      Assert.assertNotNull(conditionField);

      // test hide field
View Full Code Here

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

      simpleVariableField.displayField(newTextSpanElement);

      // declare user variable
      VariableField userVariableField = Fields.createUserVariableField(doc, "test_user_variable", "test");
      Assert.assertNotNull(userVariableField);
      OdfTextParagraph newParagraph = doc.newParagraph("Update User Variable Field:");
      userVariableField.updateField("user variable content", null);
      newParagraph = doc.newParagraph("Show User Variable Field:");
      userVariableField.displayField(newParagraph);
    } catch (Exception e) {
      Logger.getLogger(FieldsTest.class.getName()).log(Level.SEVERE, null, e);
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

   */
  @Test
  public void testInsertImage_URI() throws Exception {
    LOG.info("insertImage from URI");
    OdfTextDocument odt = OdfTextDocument.newTextDocument();
    OdfTextParagraph para = (OdfTextParagraph) odt.getContentRoot().newTextPElement();
    OdfDrawFrame frame = (OdfDrawFrame) para.newDrawFrameElement();
    OdfDrawImage image = (OdfDrawImage) frame.newDrawImageElement();
    String packagePath = image.newImage(ResourceUtilities.getURI("testA.jpg"));
    assertEquals(image.getXlinkTypeAttribute(), "simple");
    LOG.info(frame.getSvgWidthAttribute());
    LOG.info(frame.getSvgHeightAttribute());
View Full Code Here

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

   */
  @Test
  public void testInsertImage_InputStream() throws Exception {
    LOG.info("insertImage from InputStream");
    OdfTextDocument odt = OdfTextDocument.newTextDocument();
    OdfTextParagraph para = (OdfTextParagraph) odt.getContentRoot().newTextPElement();
    OdfDrawFrame frame = (OdfDrawFrame) para.newDrawFrameElement();
    OdfDrawImage image = (OdfDrawImage) frame.newDrawImageElement();
    String packagePath = "Pictures/myChosenImageName.jpg";
    String mediaType = "image/jpeg";
    image.newImage(new FileInputStream(ResourceUtilities.getAbsolutePath("testA.jpg")), packagePath, mediaType);
    assertEquals(image.getXlinkTypeAttribute(), "simple");
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
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.