Package org.odftoolkit.simple.common.navigation

Examples of org.odftoolkit.simple.common.navigation.TextSelection.replaceWith()


    search = new TextNavigation("Container", doc);
    i = 0;
    while (search.hasNext()) {
      item = (TextSelection) search.nextSelection();
      Paragraph paragraph = sourcedoc.getParagraphByIndex(2, true);
      item.replaceWith(paragraph);
      i++;
    }
    search = new TextNavigation("Hello3 from source document!", doc);
    j = 0;
    while (search.hasNext()) {
View Full Code Here


    try {
      while (search.hasNext()) {
        i++;
        item = (TextSelection) search.nextSelection();
        Paragraph paragraph = sourcedoc.getParagraphByIndex(1, true);
        paragraph = item.replaceWith(paragraph);
        Assert.assertNotNull(paragraph);
        Assert.assertEquals(
            TextExtractor.getText(paragraph.getOdfElement()),
            "Hello2 from source document!");
      }
View Full Code Here

    // Paragraph, insert before the second Paragraph.
    search = new TextNavigation("SIMPLE", doc);
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      try {
        Field newField = item.replaceWith(orgField);
      } catch (InvalidNavigationException e) {
        e.printStackTrace();
      }
    }
    try {
View Full Code Here

      }
      nextTextSelection = (TextSelection) search.nextSelection();
      if (currtenTextSelection != null) {
       
        try {
          currtenTextSelection.replaceWith(sourcedoc);
          i++;
        } catch (Exception e) {
          e.printStackTrace();
          Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
        }
View Full Code Here

    int i = 0;
    while (search.hasNext()) {
      if (i > 0) {
        TextSelection item = (TextSelection) search.nextSelection();
        try {
          item.replaceWith("Odf Toolkit");
          item.applyStyle(style);
        } catch (InvalidNavigationException e) {
          Assert.fail(e.getMessage());
        }
      }
View Full Code Here

    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      try {
        String text = item.getText();
        text = text.substring(2, text.length() - 2);
        item.replaceWith(text);
      } catch (InvalidNavigationException e) {
        Assert.fail(e.getMessage());
      }
    }
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.