Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Book


  protected void tearDown() throws Exception {
    super.tearDown();
  }
 
  public void testErrorFormula() {
    Book book = new ExcelImporter().imports(getClass().getResource("/div0.xls"));
    String[] names = book.getNameRangeNames();
    System.out.println("names="+Objects.toString(names));
    Sheet sheet = (Sheet) book.getSheets().get(0);

    //test single column range
    for (int j = 1; j < 8; ++j) { //A1 ~ A7
      Cell cell = sheet.getCell(j-1,0);
      assertEquals(""+j, cell.getText());
View Full Code Here


    super.tearDown();
  }

  public void testWidths() {
    final String nm = "widths.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    int[][] widths = sheet1.getColumnWidths();
    assertEquals(1, widths.length);
    assertEquals(5, widths[0][0]);
  }
View Full Code Here

    assertEquals(5, widths[0][0]);
  }
 
  public void test1919118() {
    final String nm = "B-1919118.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    assertEquals("Marketing Division 3", ((SheetImpl)sheet1).getCell(1, 1).getText());
    assertEquals("05-15743", ((SheetImpl)sheet1).getCell(3, 1).getText());
   
    ((SheetImpl)sheet1).setCellEditText(1, 1, "Marketing Division 3"); //B2
    assertEquals("Marketing Division 3", ((SheetImpl)sheet1).getCell(1, 1).getText());
View Full Code Here

    assertEquals("05-15743", ((SheetImpl)sheet1).getCell(3, 1).getText());
  }
 
  public void test1988691() {
    final String nm = "B-1988691.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    assertEquals("2008", ((SheetImpl)sheet1).getCell(1, 1).getText()); //B2
    assertEquals("1234.5678", ((SheetImpl)sheet1).getCell(3, 1).getText()); //B4

    ((SheetImpl)sheet1).setCellEditText(1, 1, "2008"); //B2
    assertEquals("2008", ((SheetImpl)sheet1).getCell(1, 1).getText());
View Full Code Here

    assertEquals("1234.5678", ((SheetImpl)sheet1).getCell(3, 1).getText());
  }
 
  public void test1992587() {
    final String nm = "B-1992587.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    assertEquals("#ff0000", ((SheetImpl)sheet1).getCell(1, 1).getFormat().getFillColor()); //B2
    assertEquals("#008000", ((SheetImpl)sheet1).getCell(5, 1).getFormat().getFillColor()); //B6
 
    //insert two columns
    sheet1.insertColumns(2, 3);
View Full Code Here

    assertEquals("#ff0000", ((SheetImpl)sheet1).getCell(3, 3).getFormat().getFillColor()); //D4
  }
 
  public void test1991498() {
    final String nm = "B-1991498.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    assertEquals("#ff0000", ((SheetImpl)sheet1).getCell(1, 2).getFormat().getFontColor()); //C2
    assertEquals("#ff0000", ((SheetImpl)sheet1).getCell(1, 2).getTextColor()); //C2
   
    final Cell cell = sheet1.getCell(1,2);
    FormatImpl newFormat;
View Full Code Here

    }
  }
 
  public void test1990542() {
    final String nm = "B-1991498.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    final SimpleSSDataListener ssl = new SimpleSSDataListener();
    book.addSSDataListener(ssl);
   
    FormatImpl newFormat = new FormatImpl();
    newFormat.setFontColor("green");
    sheet1.getCell(1,2).setFormat( newFormat );
   
View Full Code Here

    assertEquals(1, org.getBottom());
  }
 
  public void test1997415() {
    final String nm = "B-1997415.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
   
    String a1str = sheet1.getCell(0, 0).getText(); //a1
    String a2str = sheet1.getCell(1, 0).getText(); //a2
   
    assertEquals("", a1str);
View Full Code Here

   
  }
 
  public void test1997417() {
    final String nm = "B-1997417.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    final SimpleSSDataListener ssl = new SimpleSSDataListener();
    book.addSSDataListener(ssl);
   
    sheet1.setCellValue(11, 4, new Integer(10));
   
    List evts = ssl.getList();
    assertEquals(5, evts.size());
View Full Code Here

    assertEquals("=SUM(A1:B2)", cell.getEditText());
  }
 
  public void test2002276(){
    final String nm = "B-2002276.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    Iterator iter = sheet1.getImages().iterator();
    Image image = (Image)iter.next();
    assertEquals(1,image.getColumn());
    assertEquals(2,image.getRow());
    assertEquals(0.015625,image.getColumnFraction());
View Full Code Here

TOP

Related Classes of org.zkoss.zss.model.Book

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.