Package org.odftoolkit.simple

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


      Assert.assertEquals(FieldType.SIMPLE_VARIABLE_FIELD, fieldType);
      newTextSpanElement = doc.newParagraph("Show Simple Variable Field:").newTextSpanElement();
      simpleVariableField.displayField(newTextSpanElement);
      simpleVariableField.updateField("aaaa", newTextSpanElement);
      try {
        doc.save(ResourceUtilities.newTestOutputFile("TextFieldSampleDocumentVariableField.odt"));
      } catch (Exception e) {
        Logger.getLogger(FieldSelectionTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
        Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
      }
    } catch (Exception e) {
View Full Code Here


        item.addComment("simpleODF should be replaced by Simple ODF.", "devin-"+i);
        i++;
      }
      // there are 7 simpleODF in this test document.
      Assert.assertEquals(7, i);
      textDoc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_COMMENT));
    } catch (Exception e) {
      Logger.getLogger(TextSelectionTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
  }
View Full Code Here

      textDocument.addParagraph("below, table in footer Standard (bug with getWidth, but the widths are good)");
      table = textDocument.getFooter().addTable(1, 8);
      columnsWidth = new long[] { 5, 19, 11, 14, 27, 12, 75, 4 };
      setColumnsWidth(table, columnsWidth);
     
      textDocument.save(ResourceUtilities.newTestOutputFile("testColumsWidth.odt"));
    } catch (Exception e) {
      Logger.getLogger(TableRowColumnTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

      writeProperties.setBreak("before", "page");
      Assert.assertEquals("page", readProperties.getBreakBefore());

      // save
      doc.save(ResourceUtilities
          .newTestOutputFile("AAAA1.ods"));

      writeProperties.setBreak("before", null);
      Assert.assertEquals(null, readProperties.getBreakBefore());
View Full Code Here

      Assert.assertTrue(savedCellRange.getColumnNumber() == 3);
      Cell savedCell = savedCellRange.getCellByPosition(0, 0);
      NodeList paraList = savedCell.getOdfElement().getChildNodes();
      Assert.assertTrue(paraList.item(2) instanceof OdfTextParagraph);
      Assert.assertEquals(TextExtractor.getText((OdfTextParagraph) paraList.item(2)), "0.00");
      saveddoc.save(ResourceUtilities.newTestOutputFile(odtfilename + "MergeCoveredCell.odt"));
    } catch (Exception e) {
      Logger.getLogger(TableCellRangeTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
View Full Code Here

      savedCellRange.merge();
      Assert.assertTrue(savedCellRange.getColumnNumber() == 2);
      Assert.assertTrue(savedCellRange.getRowNumber() == 2);
      Cell savedCell = savedCellRange.getCellByPosition(0, 1);
      Assert.assertTrue(savedCell.getOdfElement() instanceof TableCoveredTableCellElement);
      saveddoc.save(ResourceUtilities.newTestOutputFile(odtfilename + "MergeCoveredCell2.odt"));
    } catch (Exception e) {
      Logger.getLogger(TableCellRangeTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
  }
View Full Code Here

      Assert.assertEquals("page", readProperties.getBreakBefore());
      writeProperties.setPageNumber(3);
      Assert.assertEquals(3, readProperties.getPageNumber());

      // save
      doc.save(ResourceUtilities
          .newTestOutputFile("AAAA2.ods"));

      writeProperties.setPageNumber(0);
      Assert.assertEquals(0, readProperties.getPageNumber());
      writeProperties.setPageNumber(-2);
View Full Code Here

      CellRange firstTwoColumn = savedTable.getCellRangeByPosition(0, 0, 1, savedTable.getRowCount() - 1);
      firstTwoColumn.merge();
      Cell cell1 = firstTwoColumn.getCellByPosition(0, 2);
      Cell firstCell1 = firstTwoColumn.getCellByPosition(0, 0);
      Assert.assertTrue(cell1.getOwnerTableCell().equals(firstCell1));
      saveddoc.save(ResourceUtilities.newTestOutputFile(odtfilename + "MergeFirstTwoColumn.odt"));
    } catch (Exception e) {
      Logger.getLogger(TableCellRangeTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
    }
  }
View Full Code Here

      Table swTable = Table.newTable(odt, 1, 5);
      CellRange swCellRange = swTable.getCellRangeByPosition("A1", "E2");
      Cell swCell = swTable.getCellByPosition("E2");
      swCell.setStringValue("Merge A1:E2");
      swCellRange.merge();
      odt.save(ResourceUtilities.newTestOutputFile(odtfilename + "MergeTextExpandCell.odt"));
      swTable = odt.getTableList().get(0);
      Assert.assertTrue(swTable.getColumnCount() == 1);
      Assert.assertTrue(swTable.getRowCount() == 1);
    } catch (Exception ex) {
      Logger.getLogger(TableCellRangeTest.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
View Full Code Here

      paragraph1.setHorizontalAlignment(HorizontalAlignmentType.RIGHT);
      align = paragraph1.getHorizontalAlignment();
      Assert.assertEquals(HorizontalAlignmentType.RIGHT, align);

      doc.save(ResourceUtilities.newTestOutputFile("TestParagraphPropertiesSetGetHoriAlignment.odt"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail();
    }
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.