Examples of TextDocument


Examples of org.odftoolkit.simple.TextDocument

 
  @Test
  public void testGetTableBuilder() {
    try {
      //TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      TextDocument doc = TextDocument.newTextDocument();
      Footer footer = doc.getFooter();
      //Table tab = footer.addTable();
     
      TableBuilder tb = footer.getTableBuilder();
      Table tab = tb.newTable();
     
      Assert.assertNotNull(tab);
      Assert.assertTrue(2 == tab.getRowCount());
      Assert.assertTrue(5 == tab.getColumnCount());
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile("footerOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(FooterTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

 
  @Test
  public void testGetVariableContainerElement() {
    try {
      //TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      TextDocument doc = TextDocument.newTextDocument();
      Footer footer = doc.getFooter();
      OdfElement odfEle = footer.getVariableContainerElement();
     
      TableBuilder tb = footer.getTableBuilder();
      Table tab = tb.newTable();
     
      Assert.assertNotNull(tab);
      Assert.assertTrue(2 == tab.getRowCount());
      Assert.assertTrue(5 == tab.getColumnCount());
     
      Node nod = odfEle.getFirstChild();
      Assert.assertEquals("table:table", nod.getNodeName());
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile("footerOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(FooterTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

 
 
  @Test
  public void testDeclareVariable() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Footer footer = doc.getFooter();
      footer.declareVariable("footername", VariableType.USER);
     
      //validate
      StyleFooterElement styleFoot = footer.getOdfElement();
      Node nod = styleFoot.getFirstChild().getFirstChild();
      NamedNodeMap nameMap = nod.getAttributes();
      Node nodtext = nameMap.getNamedItem("text:name");
      Assert.assertEquals("footername", nodtext.getNodeValue());
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile("footerOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(FooterTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

 
 
  @Test
  public void testGetVariableFieldByName() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Footer footer = doc.getFooter();
      footer.declareVariable("footername", VariableType.USER);
      VariableField vField = footer.getVariableFieldByName("footername");
      String vName = vField.getVariableName();
     
      //validate
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

  @Test
  public void testGetSetTextContent() {
    try {
      // load test list container, which contains 2 lists.
      TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT));
      Iterator<List> listIterator = odtdoc.getListIterator();
      if (listIterator.hasNext()) {
        List list = listIterator.next();
        ListItem item = list.getItem(0);
        String itemText = item.getTextContent();
        Assert.assertEquals("bullet item1", itemText);
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

  @Test
  public void testGetSetStartNumber() {
    try {
      // load test list container, which contains 2 lists.
      TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT));
      Iterator<List> listIterator = odtdoc.getListIterator();
      if (listIterator.hasNext()) {
        List list = listIterator.next();
        list = listIterator.next();
        ListItem item = list.getItem(0);
        Integer startNumber = item.getStartNumber();
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

  @Test
  public void testGetSetNumberFormat() {
    try {
      // load test list container, which contains 2 lists.
      TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT));
      Iterator<List> listIterator = odtdoc.getListIterator();
      if (listIterator.hasNext()) {
        List list = listIterator.next();
        list = listIterator.next();
        ListItem item = list.getItem(0);
        String numberFormat = item.getNumberFormat();
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

  @Test
  public void testGetOwnerList() {
    try {
      // load test list container, which contains 2 lists.
      TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT));
      Iterator<List> listIterator = odtdoc.getListIterator();
      if (listIterator.hasNext()) {
        List list = listIterator.next();
        ListItem item = list.getItem(0);
        List ownerList = item.getOwnerList();
        Assert.assertEquals(list.getOdfElement(), ownerList.getOdfElement());
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

  @Test
  public void testGetIndex() {
    try {
      // load test list container, which contains 2 lists.
      TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT));
      Iterator<List> listIterator = odtdoc.getListIterator();
      if (listIterator.hasNext()) {
        List list = listIterator.next();
        java.util.List<ListItem> items = list.getItems();
        int i = 0;
        for (ListItem item : items) {
View Full Code Here

Examples of org.odftoolkit.simple.TextDocument

  @Test
  public void testAddRemoveIterateSubList() {
    try {
      // load test list container, which contains 2 lists.
      TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT));
      ListDecorator bulletDecorator = new BulletDecorator(odtdoc);
      ListDecorator numberDecorator = new NumberDecorator(odtdoc);
      ListDecorator imageDecorator = new ImageDecorator(odtdoc, ResourceUtilities.getURI("image_list_item.png"));
      Iterator<List> listIterator = odtdoc.getListIterator();

      if (listIterator.hasNext()) {
        List list = listIterator.next();
        // add list.
        ListContainer container = list.getItem(0);
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.