Package org.odftoolkit.simple

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


  public void testCopyPasteResource() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("Sections.odt"));
      Section theSec = doc.getSectionByName("ImageSection");
      String newName = doc.appendSection(theSec, false).getName();
      doc.save(ResourceUtilities.newTestOutputFile("NewSection.odt"));

      TextDocument newDoc = TextDocument
          .loadDocument(ResourceUtilities.getTestResourceAsStream("NewSection.odt"));
      theSec = newDoc.getSectionByName("ImageSection");
      Section newSec = newDoc.getSectionByName(newName);
View Full Code Here


        doc.newParagraph("----End of " + aSection.getName() + "---------");
        doc.newParagraph();
        doc.newParagraph();
        doc.newParagraph();
      }
      doc.save(ResourceUtilities.newTestOutputFile("NewSections.odt"));

      doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("NewSections.odt"));
      sections = doc.getSectionIterator();
      int i = 0;
      while (sections.hasNext()) {
View Full Code Here

  public void testSetGetName() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("Sections.odt"));
      Section theSec = doc.getSectionByName("ImageSection");
      theSec.setName("ImageSection_NewName");
      doc.save(ResourceUtilities.newTestOutputFile("NewSection.odt"));

      TextDocument newDoc = TextDocument
          .loadDocument(ResourceUtilities.getTestResourceAsStream("NewSection.odt"));
      theSec = newDoc.getSectionByName("ImageSection");
      Assert.assertNull(theSec);
View Full Code Here

      chart.setUseLegend(false);
      chart.setChartType(ChartType.RADAR);
      Assert.assertEquals(chart.getChartTitle(), "Chart with local-data");
      Assert.assertTrue(chart.isUseLegend() == false);
      Assert.assertEquals(chart.getChartType(), ChartType.RADAR);
      doc.save(ResourceUtilities.newTestOutputFile(CHART_FILE_ODT));

      PresentationDocument pDoc = PresentationDocument.newPresentationDocument();
      pDoc.createChart(title, lables, legends, data, rect);
      pDoc.save(ResourceUtilities.newTestOutputFile(CHART_FILE_ODP));
View Full Code Here

      createTableWithData(document);
      document.newParagraph();
      document.newParagraph("Table with string values:");
      createTableWithString(document);

      document.save(ResourceUtilities.newTestOutputFile("CreateTableCase.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.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

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.