Package org.odftoolkit.odfdom.doc

Examples of org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument


    }
  }

  @Test
  public void testSetDefaultCellStyle() {
    OdfSpreadsheetDocument outputDocument;
    OdfContentDom contentDom; // the document object model for content.xml
    OdfStylesDom stylesDom; // the document object model for styles.xml
    // the office:automatic-styles element in content.xml
    OdfOfficeAutomaticStyles contentAutoStyles;
    // the office:styles element in styles.xml
    OdfOfficeStyles stylesOfficeStyles;
    OdfStyle style;
    String noaaDateStyleName;
    String noaaTempStyleName;

    try {
      outputDocument = OdfSpreadsheetDocument.newSpreadsheetDocument();
      contentDom = outputDocument.getContentDom();
      contentAutoStyles = contentDom.getOrCreateAutomaticStyles();

      OdfNumberDateStyle dateStyle = new OdfNumberDateStyle(contentDom,
          "yyyy-MM-dd", "numberDateStyle", null);
      OdfNumberStyle numberStyle = new OdfNumberStyle(contentDom,
View Full Code Here


    }
  }
       
        @Test
        public void testGetFromEmptyDateValue() throws Exception {
            OdfSpreadsheetDocument doc = OdfSpreadsheetDocument.newSpreadsheetDocument();
            OdfTable table = OdfTable.newTable(doc);
            OdfTableCell dateCell = table.appendRow().getCellByIndex(0);
            dateCell.setValueType(OfficeValueTypeAttribute.Value.DATE.toString());
            Assert.assertNull(dateCell.getDateValue());
        }
View Full Code Here

            Assert.assertNull(dateCell.getDateValue());
        }
       
        @Test
        public void testGetFromEmptyTimeValue() throws Exception {
            OdfSpreadsheetDocument doc = OdfSpreadsheetDocument.newSpreadsheetDocument();
            OdfTable table = OdfTable.newTable(doc);
            OdfTableCell timeCell = table.appendRow().getCellByIndex(0);
            timeCell.setValueType(OfficeValueTypeAttribute.Value.TIME.toString());
            Assert.assertNull(timeCell.getTimeValue());
        }
View Full Code Here

    cellRange1.setCellRangeName("TimeCellRange");
    cellRange1.merge();

    saveods("CellRangeName");
    try {
      OdfSpreadsheetDocument saveddos = (OdfSpreadsheetDocument) OdfSpreadsheetDocument.loadDocument(ResourceUtilities.getAbsolutePath(filename + "CellRangeName.ods"));
      OdfTable savedSheet = saveddos.getTableByName("Sheet1");
      OdfTableCellRange namedCellRange = savedSheet.getCellRangeByName("TimeCellRange");
      OdfTableCell cell = namedCellRange.getCellByPosition("A1");
      Assert.assertTrue(cell.getRowSpannedNumber() == 6);
    } catch (Exception e) {
      Logger.getLogger(TableCellRangeTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

  }

  @Test
  public void testMergeExpandCellRange() {
    try {
      OdfSpreadsheetDocument ods = OdfSpreadsheetDocument
          .newSpreadsheetDocument();
      // the doc contain the table which only have one column and one row
      // element
      OdfTable table = ods.getTableByName("Sheet1");
      int nCols = table.getColumnCount();
      int nRows = table.getRowCount();
      Assert.assertTrue(nCols == 1);
      Assert.assertTrue(nRows == 1);
      OdfTableCellRange cellRange = table.getCellRangeByPosition("A1","E1");
      OdfTableCell cell = table.getCellByPosition("A1");
      cell.setStringValue("Merge A1:E1");
      cellRange.merge();
      OdfTable table2 = OdfTable.newTable(ods, 1, 1);
      table2.setTableName("Sheet2");
      OdfTableCellRange cellRange2 = table2.getCellRangeByPosition("A1","F3");
      OdfTableCell cell2 = table2.getCellByPosition("A1");
      cell2.setStringValue("Merge A1:F3");
      cellRange2.merge();
      ods.save(ResourceUtilities.newTestOutputFile(filename + "MergeExpandCell.ods"));
      table = ods.getTableByName("Sheet1");
      Assert.assertTrue(table.getColumnCount() == 5);
      Assert.assertTrue(table.getRowCount() == 1);
      table = ods.getTableByName("Sheet2");
      Assert.assertTrue(table.getColumnCount() == 6);
      Assert.assertTrue(table.getRowCount() == 3);
      OdfTextDocument odt = OdfTextDocument.newTextDocument();
      OdfTable swTable = OdfTable.newTable(odt, 1, 5);
      OdfTableCellRange swCellRange = swTable.getCellRangeByPosition("A1", "E2");
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument

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.