Package org.odftoolkit.simple.common.navigation

Examples of org.odftoolkit.simple.common.navigation.TextNavigation.nextSelection()


  public void testSpan() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is a test paragraph!");
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
      TextHyperlink link = span.applyHyperlink(new URI("http://www.ibm.com"));
      DefaultStyleHandler handler = span.getStyleHandler();
      Font font1Base = new Font("Arial", FontStyle.ITALIC, 10, Color.BLACK, TextLinePosition.THROUGH);
      handler.getTextPropertiesForWrite().setFont(font1Base);
View Full Code Here


      }
     
      doc.addParagraph("This is a test paragraph!");
     
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
     
      span.removeTextContent();
      boolean flag = false;
      Iterator<Paragraph> parai = doc.getParagraphIterator();
View Full Code Here

    try {
      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is a test paragraph!");
     
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
     
      span.appendTextContent("hello world.");
      Assert.assertEquals("testhello world.", span.getTextContent());
View Full Code Here

    try {
      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is a test paragraph!");
     
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
     
      span.appendTextContent("hello world.", true);
      Assert.assertEquals("testhello world.", span.getTextContent());
     
View Full Code Here

  @Test
  public void testGetInstance() {
    //get the text content contains "cell"
    TextNavigation search = new TextNavigation("cell", odtdoc);
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      OdfElement containerEle = item.getContainerElement();
      if (containerEle instanceof OdfTextParagraph) {
        Node ele = containerEle.getParentNode();
        if (ele instanceof TableTableCellElement) {
          Cell cell = Cell.getInstance((TableTableCellElementBase) ele);
View Full Code Here

    search = null;
    search = new TextNavigation("delete", doc);
    TextSelection sel = null;

    TextNavigation search1 = new TextNavigation("change", doc);
    sel = (TextSelection) search1.nextSelection();

    int i = 0;
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      i++;
View Full Code Here

    search = null;
    search = new TextNavigation("delete", doc);
    TextSelection sel = null;

    TextNavigation search1 = new TextNavigation("change", doc);
    sel = (TextSelection) search1.nextSelection();

    int i = 0;
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      i++;
View Full Code Here

    search = null;
    search = new TextNavigation("SIMPLE", doc);

    TextSelection nextSelect = null;
    TextNavigation nextsearch = new TextNavigation("next", doc);
    nextSelect = (TextSelection) nextsearch.nextSelection();

    // replace all the "SIMPLE" to "Odf Toolkit"
    // except the sentence
    // "Task5.Change the SIMPLE to Odf Toolkit, and bold them."
    OdfStyle style = new OdfStyle(contentDOM);
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.