Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Book


    }
    final StringBuffer sb = new StringBuffer(32);
    final VariableResolver resolver = ctx.getVariableResolver();
    final Reference ref = (Reference) resolver.resolveVariable("zkoss.ss.Ref");
    final Sheet orgsheet = ref.getSheet();
    final Book orgbook = orgsheet.getBook();
   
    final Sheet sheet = cell.getSheet();
    final Book book = sheet.getBook();
    if (book != orgbook) {
      sb.append("[").append(book.getName()).append("]");
    }
    if (sheet != orgsheet) {
      sb.append(sheet.getName()+"!");
    }
    return sb.append(Indexes.toA1(cell.getRow(), cell.getColumn(), absrow, abscol)).toString();
View Full Code Here


    }
    final StringBuffer sb = new StringBuffer(32);
    final VariableResolver resolver = ctx.getVariableResolver();
    final Reference ref = (Reference) resolver.resolveVariable("zkoss.ss.Ref");
    final Sheet orgsheet = ref.getSheet();
    final Book orgbook = orgsheet.getBook();
   
    final Sheet sheet = rng.getSheet();
    final Sheet sheetTo = rng.getSheetTo();
    final Book book = sheet.getBook();
    if (book != orgbook) {
      sb.append("[").append(book.getName()).append("]");
    }
    if (sheet != orgsheet) {
      sb.append(sheet.getName());
      if (sheetTo != null) {
        sb.append(":").append(sheetTo.getName());
View Full Code Here

    super(name);
  }

  protected void setUp() throws Exception {
    super.setUp();
    final Book book = new BookImpl("Mybook");
    _sheet = new SheetImpl(book, "Sheet1", 256, 64*1024);
  }
 
View Full Code Here

  }
 
  public void testImportedColor(){
    if(true) return;//never success now;
    final String nm = "B-1982904.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
   
    int[][] cells = new int[][]{{1,1},{2,1},{3,1},{4,1},{5,1},{6,1}};
    String[] colors = new String[]{"#CC0000","#CC9900","#008000","#006699","#3333FF","#FF00FF",};
   
   
View Full Code Here

  /**
   * Test method for {@link jxl.read.biff.WorkbookParser#parse()}.
   */
  public void testVariableResolving() {
    final String nm = "var1.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    assertEquals("=ABCD.value.text", sheet1.getCell(0,0).getEditText());
    assertEquals("=ivan", sheet1.getCell(1,0).getEditText());
    assertEquals("=ivnulla", sheet1.getCell(2,0).getEditText());
   
    assertEquals("#NAME?", sheet1.getCell(0,0).getText());
   
    Map map = new HashMap();
    SimpleResolver resolver = new SimpleResolver(map);
    map.put("ABCD", new VarObject("Hello ZK"));
    book.addVariableResolver(resolver);
   
    SimpleSSDataListener listener = new SimpleSSDataListener();
    book.addSSDataListener(listener);
   
    book.notifyChange(new String[] {"ABCE"});
    List events = listener.getList();
    assertEquals(0, events.size());
   
    book.notifyChange(new String[] {"ABCD"});
    events = listener.getList();
    assertEquals(1, events.size());

    SSDataEvent event = (SSDataEvent) events.get(0);
    Range rng = event.getRange();
View Full Code Here

  }
 
  public void testFunctionMapper() {
    final String nm = "fun1.xls";

    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    assertEquals("#NAME?", sheet1.getCell(0,0).getText());

    Map map = new HashMap();
    SimpleResolver resolver = new SimpleResolver(map);
    map.put("DEF", "Hello ZK");
    book.addVariableResolver(resolver);

    FunctionMapper mapper = new MyMapper();
    book.addFunctionMapper(mapper);
    Cell cellA1 = sheet1.getCell(0,0);
System.out.println(cellA1.getValue());
   
Cell cellA2 = sheet1.getCell(1,0);
System.out.println(cellA2.getValue());
View Full Code Here

  }
 
  public void testSpecialFunction2() {
    final String nm = "fun2.xls";

    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    Cell cellA1 = sheet1.getCell(0,0);
    assertEquals("=MROUND(10.0,3.0)", cellA1.getEditText());
    assertEquals("9", cellA1.getText());
   
    Cell cellB1 = sheet1.getCell(0,1);
View Full Code Here

  }
 
  public void testSpecialFunction3() {
    final String nm = "fun3.xls";

    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    Cell cellA1 = sheet1.getCell(0,0);
    assertEquals("=DB(3000000.0,200000.0,10.0,2.0,9.0)", cellA1.getEditText());
    Cell cellA2 = sheet1.getCell(1,0);
    assertEquals("=PMT(0.1/12.0,6.0,100000.0,2000.0,1.0)", cellA2.getEditText());
//    assertEquals("9", cellA1.getText());
View Full Code Here

    super.tearDown();
  }

  public void testImage() {
    final String nm = "image.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
  }
View Full Code Here

    if (arg instanceof SSError) {
      throw new SSErrorXelException((SSError) arg);
    } else if (arg instanceof Range) { // a range, iterator thru available
                      // cells
      final Range rng = (Range) arg;
      final Book book = rng.getSheet().getBook();
      final Collection cells = rng.getCells();
      for(final Iterator it = cells.iterator(); it.hasNext();) {
        final Cell cell = (Cell) it.next();
        total= sumDeviation(total, cell.getResult(),mean, (XelContext) book); // recursive
      }
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.