Package org.odftoolkit.odfdom.incubator.doc.text

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


        } else if (e instanceof OdfTextSpan) {// text:span
            // System.out.println(e.getTextContent());
            // sembra che se automatic.style � vuoto allora esiste uno stile
            // definito che pu� definire bold e italic
            OdfTextSpan ots = (OdfTextSpan) e;

            if (ots.getAutomaticStyle() != null) {// probabile che sia stato
                                                  // modificato lo stile
                newElement = getCurrentResource().getDocument().createElement("span");
                dstElement.add(newElement);
                newElement.setClassName(ots.getStyleName());
                stylesPropsToCSS(ots.getAutomaticStyle().getStyleProperties(), newElement.getClassName());
                if (isDebugMode()) {
                    Utils.printStyleProps(ots.getAutomaticStyle().getStyleProperties());
                }
            }

        } else if (e instanceof Text && e instanceof CharacterData) {
            dstElement.add(e.getTextContent());
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.incubator.doc.text.OdfTextSpan

Copyright © 2018 www.massapicom. 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.