Examples of OdfWhitespaceProcessor


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

      OdfTableCellRange savedCellRange = savedTable1.getCellRangeByPosition(1, 0, 2, 0);
      savedCellRange.merge();
      Assert.assertTrue(savedCellRange.getColumnNumber() == 3);
      OdfTableCell savedCell = savedCellRange.getCellByPosition(0, 0);
      NodeList paraList = savedCell.getOdfElement().getChildNodes();
      OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
      Assert.assertTrue(paraList.item(2) instanceof OdfTextParagraph);
      Assert.assertEquals(textProcessor.getText(paraList.item(2)),"0.00");
      saveddoc.save(ResourceUtilities.newTestOutputFile(odtfilename + "MergeCoveredCell.odt"));
    } catch (Exception e) {
      Logger.getLogger(TableCellRangeTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
View Full Code Here

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

  @Test
  public void testGetNextMatchElement() {

    search = null;
    search = new TextNavigation("delete", doc);
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();

    try {
      //NodeList list = doc.getContentDom().getElementsByTagName("text:p");
      OdfElement firstmatch = (OdfElement) search.getNextMatchElement(doc.getContentRoot());
      Assert.assertNotNull(firstmatch);
      Assert.assertEquals("Task2.delete next paragraph", textProcessor.getText(firstmatch));

      OdfElement secondmatch = (OdfElement) search.getNextMatchElement(firstmatch);
      Assert.assertNotNull(secondmatch);
      Assert.assertEquals("Hello [delete], I will be delete", textProcessor.getText(secondmatch));

      OdfElement thirdmatch = (OdfElement) search.getNextMatchElement(secondmatch);
      Assert.assertNotNull(thirdmatch);
      Assert.assertEquals("indeed   delete", textProcessor.getText(thirdmatch));

      OdfElement match4 = (OdfElement) search.getNextMatchElement(thirdmatch);
      Assert.assertNotNull(match4);
      Assert.assertEquals("different span in one single word delete indeed", textProcessor.getText(match4));

      OdfElement match5 = (OdfElement) search.getNextMatchElement(match4);
      Assert.assertNotNull(match5);
      Assert.assertEquals("Hello delete this word delete true delete  indeed", textProcessor.getText(match5));

    } catch (Exception e) {
      Logger.getLogger(TextNavigationTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
View Full Code Here

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

   */
  @Test
  public void testAppend() {
    LOG.info("append");
    Element element = null;
    OdfWhitespaceProcessor instance = new OdfWhitespaceProcessor();
    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.OdfWhitespaceProcessor

   */
  @Test
  public void testGetText() {
    LOG.info("getText");
    Node element = null;
    OdfWhitespaceProcessor instance = new OdfWhitespaceProcessor();
    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.OdfWhitespaceProcessor

   * @return the text displayed in this cell
   */
  public String getDisplayText() {
    //TODO: This function doesn't work well if a cell contains a list.
    //Refer to testGetSetTextValue();
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    return textProcessor.getText(mCellElement);
  }
View Full Code Here

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

    if (content == null) {
      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.OdfWhitespaceProcessor

    if (content == null) {
      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.OdfWhitespaceProcessor

   *
   * @param fromCell  another cell whose content will be appended to this cell
   */
  void appendContentFrom(OdfTableCell fromCell) {
    splitRepeatedCells();
    OdfWhitespaceProcessor textProcess = new OdfWhitespaceProcessor();
    TableTableCellElementBase cell = fromCell.getOdfElement();
    Node node = cell.getFirstChild();
    while (node != null) {
      if (node instanceof OdfTextParagraph) {
        if (!textProcess.getText(node).equals("")) {
          mCellElement.appendChild(node.cloneNode(true));
        }
      } else {
        mCellElement.appendChild(node.cloneNode(true));
      }
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.