Examples of OdfTextSpan


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

    String part1 = "span ";
    String part2 = "content";
    String styleName = "testStyle";
    String spanStyleName = "spanStyle";
    OdfTextParagraph instance = new OdfTextParagraph(dom);
    OdfTextSpan subElement;
    Element element;
    Node node;
    Assert.assertNotNull(instance);
    instance.addStyledContent(styleName, content).addStyledSpanWhitespace(
      spanStyleName, spanContent);

    // first item should be text
    node = instance.getFirstChild();
    Assert.assertNotNull(node);
    Assert.assertEquals(Node.TEXT_NODE, node.getNodeType());
    Assert.assertEquals(content, node.getTextContent());
    Assert.assertEquals(styleName, instance.getStyleName());

    // followed by a span
    node = node.getNextSibling();
    Assert.assertNotNull(node);
    Assert.assertEquals(Node.ELEMENT_NODE, node.getNodeType());
    Assert.assertTrue(node instanceof OdfTextSpan);
    subElement = (OdfTextSpan) node;

    // with correct style and content
    Assert.assertEquals(subElement.getStyleName(), spanStyleName);
    node = node.getFirstChild();
    Assert.assertEquals(Node.TEXT_NODE, node.getNodeType());
    Assert.assertEquals(part1, node.getTextContent());

    node = node.getNextSibling();
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.