Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Sheet


    super.tearDown();
    _book = null;
  }
 
  public void testFormula() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cell = ((SheetImpl)sheet1).setCellEditText(2,0,"="); //A3
    assertCellEquals(cell, 2, 0, "=");
  }
View Full Code Here


  }
 
  private static final DateFormat DF = new SimpleDateFormat("yyyy*MM*dd");
  private static final DateFormat TF = new SimpleDateFormat("HH:mm:ss");
  public void testGetTextHAlign() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cell = ((SheetImpl)sheet1).setCellEditText(2,0,"123"); //A3
    FormatImpl fm = new FormatImpl();
    cell.setFormat(fm);
View Full Code Here

    assertEquals(TextHAlign.CENTER, cell.getTextHAlign());
    cell.setValue("a string");
    assertEquals(TextHAlign.CENTER, cell.getTextHAlign());
  }
  public void testGetTextColor() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cell = ((SheetImpl)sheet1).setCellEditText(2,0,"123"); //A3
    FormatImpl fm = new FormatImpl();
    cell.setFormat(fm);
View Full Code Here

    fm.setFontColor("#0000FF");
   
    assertEquals("#0000FF", cell.getTextColor());
  }
  public void testFormulaEval() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("Sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("Sheet1"));
   
    assertEquals(0d, ((Double)new FormulaImpl("Sheet1!B5 * 0.5").evaluate((XelContext)_book)).doubleValue());
   
    ((SheetImpl)sheet1).setCellEditText(4, 1, "1"); //B5
View Full Code Here

    ((SheetImpl)sheet1).setCellEditText(4, 1, "b"); //B5
    assertEquals(Boolean.FALSE, ((Boolean)new FormulaImpl("Sheet1!B5 < \"a\"").evaluate((XelContext)_book)));
  }
 
  public void testFormulaParms() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cell = ((SheetImpl)sheet1).setCellEditText(2,0,"=SUM(1,2,3)"); //A3
    assertEquals(1+2+3, ((Double)cell.getResult()).doubleValue(), 0d);
   
View Full Code Here

    cell = ((SheetImpl)sheet1).setCellEditText(2,0,"=SUM(,1,3)"); //A3
    assertEquals(1+3, ((Double)cell.getResult()).doubleValue(), 0d);
  }
  public void testCrossSheetRef() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));

    Cell cell = ((SheetImpl)sheet1).setCellEditText(2,0,"=sheet2!A1"); //sheet2!A1
    assertEquals("#REF!", cell.getResult().toString());

View Full Code Here

    ((SheetImpl)sheet1).setCellEditText(0,0,"12345678901234567890"); //A1: 12345.6789
    assertEquals("1.23456789012345E19", cell.getResult().toString());
  }
 
  public void testSetEditText() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cell = ((SheetImpl)sheet1).setCellEditText(2,0,"3/4/98"); //A3
    assertEquals("1998*03*04", DF.format(cell.getValue()));

View Full Code Here

    double15 = ((Double)cell.getValue()).doubleValue();
    assertEquals(-12345678901234500000d, double15, 0d);
  }

  public void testSetEditTextWithTextFormat() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
 
    CellImpl cell = (CellImpl) sheet1.setCellValue(0, 0, null);
    FormatImpl format = new FormatImpl();
    format.setFormatCodes("@");
    cell.setFormat(format);
    cell.setEditText("05-15743"); //A1
    assertEquals("05-15743", cell.getText());
View Full Code Here

    cell.setEditText("05-15743"); //A1
    assertEquals("05-15743", cell.getText());
  }

  public void testPercentage() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cellA1 = ((SheetImpl)sheet1).setCellEditText(0,0,"64493.7"); //A1
    Cell cellA2 = ((SheetImpl)sheet1).setCellEditText(1,0,"0"); //A2
    Cell cellA3 = ((SheetImpl)sheet1).setCellEditText(2,0,"=A1-A2"); //A3
View Full Code Here

    assertEquals("100.00%", result);
   
  }
 
  public void testErrors() {
    Sheet sheet1 = ((BookImpl)_book).addSheet("sheet1", 256, 64*1024);
    assertEquals(sheet1, _book.lookupSheet("sheet1"));
   
    Cell cellA1 = ((SheetImpl)sheet1).setCellEditText(0,0,"#NULL!"); //A1
    assertEquals(SSError.NULL, cellA1.getResult());
   
View Full Code Here

TOP

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

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.