Package org.odftoolkit.simple

Examples of org.odftoolkit.simple.TextDocument.save()


      document.newParagraph("Empty table:");
      Table table = createEmptyTable(document);
      table.setWidth(width);
      Assert.assertTrue(Math.abs(width - table.getWidth()) < 3);

      document.save(ResourceUtilities.newTestOutputFile("TestSetGetWidth.odt"));

    } catch (Exception e) {
      Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
View Full Code Here


      document.newParagraph("Empty table:");
      Table table = createEmptyTable(document);
      table.setTableName(tablename);
      Assert.assertEquals(tablename, table.getTableName());

      document.save(ResourceUtilities.newTestOutputFile("TestGetSetName.odt"));
      document.close();
      document = loadODTDocument("TestGetSetName.odt");
      table = document.getTableByName(tablename);
      Assert.assertNotNull(table);
      String tablename2 = table.getTableName();
View Full Code Here

    try {
      // new another table with the same name
      // an exception will be thrown
      Table table2 = Table.newTable(document);
      table2.setTableName(tablename);
      document.save(ResourceUtilities.newTestOutputFile("TestGetSetName.odt"));
      Assert.fail("should not save the tables with the same table name.");
    } catch (Exception e) {
      if (!e.getMessage().startsWith("The table name is duplicate")) {
        Assert.fail(e.getMessage());
      }
View Full Code Here

      }

      Table table3 = Table.newTable(document, rowlabels, columnlabels, data);
      table3.setTableName(tablename);

      document.save(ResourceUtilities.newTestOutputFile(testFileName));
      document = loadODTDocument(testFileName);
      Table table = document.getTableByName(tablename);
      Column tmpColumn;
      List<Column> columns = table.getColumnList();
View Full Code Here

      }

      Table table3 = Table.newTable(document, rowlabels, columnlabels, data);
      table3.setTableName(tablename);

      document.save(ResourceUtilities.newTestOutputFile(testFileName));
      document = loadODTDocument(testFileName);
      Table table = document.getTableByName(tablename);
      Row tmpRow;
      List<Row> rows = table.getRowList();
      for (int i = 1; i < rows.size(); i++) {
View Full Code Here

      tablelist = dom.getElementsByTagNameNS(OdfDocumentNamespace.TABLE.getUri(), "table");
      for (int i = 0; i < tablelist.getLength(); i++) {
        mOdtTable = (TableTableElement) tablelist.item(i);
        testAppendRow(mOdtTable);
      }
      odtDoc.save(ResourceUtilities.newTestOutputFile("TestODTAppendRowOutput.odt"));

    } catch (Exception e) {
      Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

      TextDocument doc = TextDocument.newTextDocument();
      Table table = Table.newTable(doc, 2, 2);
      table.setTableName("ImageTable");
      Cell cell = table.getCellByPosition(0, 0);
      cell.setImage(ResourceUtilities.getURI("image_list_item.png"));
      doc.save(ResourceUtilities.newTestOutputFile("ImageCellTable.odt"));

      // load the document again.
      doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("ImageCellTable.odt"));
      table = doc.getTableByName("ImageTable");
      cell = table.getCellByPosition(0, 0);
View Full Code Here

      Assert.assertEquals(t1, paragraph2);
      t1 = cell.getParagraphByReverseIndex(2, false);
      Assert.assertEquals(t1, paragraph1);
      t1 = cell.getParagraphByReverseIndex(1, true);
      Assert.assertEquals(t1, paragraph1);
      doc.save(ResourceUtilities.newTestOutputFile("testCellParagraph.odt"));
    } catch (Exception e) {
      Logger.getLogger(TableCellTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

        } catch (InvalidNavigationException e) {
          Assert.fail(e.getMessage());
        }
      }
      Assert.assertTrue(18 == i);
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE));
    } catch (Exception e) {
      Logger.getLogger(MONPTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
  }
View Full Code Here

      Table tab1 = listTab.get(0);
      Assert.assertNotNull(tab1);
      Assert.assertEquals(tab, tab1);

      //save
      doc.save(ResourceUtilities.newTestOutputFile("headerTableOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(HeaderTest.class.getName()).log(Level.SEVERE, null, 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.