Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Book


      System.out.println(ex.getMessage());//correct and ignore
    }
  }
  public void testInsertRowOutOfRange() {
    final String nm = "row200.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
   
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    try {
      sheet1.insertRows(-1, -1);
      assertFalse("Should come here after sheet1.insertRows(-1, -1);",true);
    } catch(Exception ex) {
      System.out.println(ex.getMessage());//correct and ignore
View Full Code Here


      //correct and ignore
    }
  }
  public void testDeleteRowOutOfRange() {
    final String nm = "row200.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
   
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    try {
      sheet1.deleteRows(-1, -1);
      assertFalse("Should come here after sheet1.deleteRows(-1, -1);",true);
    } catch(Exception ex) {
      System.out.println(ex.getMessage());//correct and ignore
View Full Code Here

    super.tearDown();
  }
 
  public void testDeleteColumnsWidth() {
    final String nm = "colwidth.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    int widthA = sheet1.getColumnWidth(0);
    int widthB = sheet1.getColumnWidth(1);
    int widthC = sheet1.getColumnWidth(2);
   
    sheet1.deleteColumns(1,1);
View Full Code Here

    assertEquals(widthC, sheet1.getColumnWidth(1));
  }

  public void testInsertColumnsWidth() {
    final String nm = "colwidth.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    int widthA = sheet1.getColumnWidth(0);
    int widthB = sheet1.getColumnWidth(1);
    int widthC = sheet1.getColumnWidth(2);
   
    sheet1.insertColumns(1,3);
View Full Code Here

    super.tearDown();
  }

  public void testDeleteColumnUnnecesarySSEvent() {
    final String nm = "row200.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
    final SimpleSSDataListener ssl = new SimpleSSDataListener();
    book.addSSDataListener(ssl);

    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    sheet1.deleteColumns(2,2); //delete column C (C1 ~ C100)

    List evts = ssl.getList();
   
    for(Iterator it = evts.iterator(); it.hasNext();) {
View Full Code Here

    assertEquals(rng, evt.getRange());
  }
 
  public void testInsertColumnOutOfRange() {
    final String nm = "row200.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
   
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    try {
      sheet1.insertColumns(-1, -1);
      assertFalse("Should come here after sheet1.insertColumns(-1, -1);",true);
    } catch(Exception ex) {
      System.out.println(ex.getMessage());//correct and ignore
View Full Code Here

    }
  }

  public void testDeleteColumnOutOfRange() {
    final String nm = "row200.xls";
    Book book = new ExcelImporter().imports(getClass().getResource("/"+nm));
   
    Sheet sheet1 = (Sheet) book.getSheets().get(0);
    try {
      sheet1.deleteColumns(-1, -1);
      assertFalse("Should come here after sheet1.deleteColumns(-1, -1);",true);
    } catch(Exception ex) {
      System.out.println(ex.getMessage());//correct and ignore
View Full Code Here

 
  public Collection getCells() {
    final List list = new LinkedList();
    final Sheet sheetTo = getSheetTo();
    if (sheetTo != null) { //3d range
      final Book book = getSheet().getBook();
      final Sheet sheetFrom = getSheet();
      boolean start = false;
      boolean stop = false;
      for(final Iterator it = book.getSheets().iterator(); it.hasNext() && !stop;) {
        final Sheet sheet = (Sheet) it.next();
        if (sheet == sheetFrom) {
          start = true;
        } else if (sheet == sheetTo) {
          stop = true;
View Full Code Here

      return matrix.getCells(getLeft(), getTop(), getRight(), getBottom(), list);
    }
  }
 
  public Cell[][][] getCellsArray() {
    final Book book = getSheet().getBook();
    final Sheet sheetTo = getSheetTo();
    Cell[][][] cella = null;
    int startj = -1;
    if (sheetTo != null) { //3d range
      final Sheet sheetFrom = getSheet();
      int j = 0;
      int endj = -1;
      for(final Iterator it = book.getSheets().iterator(); it.hasNext(); ++j) {
        final Sheet sheet = (Sheet) it.next();
        if (sheet == sheetFrom) {
          startj = j;
        } else if (sheet == sheetTo) {
          endj = j;
          break;
        }
      }
      if (startj < 0 || endj < 0) { //reach sheetTo first, reverse sequence.
        throw new SSErrorXelException(SSError.REF);
      }
      final int sheetsz = endj - startj + 1;
      cella = new Cell[sheetsz][][];
     
    } else { //2d range
      startj = 0;
      cella = new Cell[1][][];
    }
    final int sheetsz = cella.length;
    final int top = getTop();
    final int left = getLeft();
    final int rowsz = getBottom() - top + 1;
    final int colsz = getRight() - left + 1;
    int sj = 0;
    for (final ListIterator it = book.getSheets().listIterator(startj); it.hasNext() && sj < sheetsz; ++sj) {
      final Sheet sheet = (Sheet) it.next();
      cella[sj] = new Cell[rowsz][];
      for (int rj = 0; rj < rowsz; ++rj) {
        cella[sj][rj] = new Cell[colsz];
        for (int cj = 0; cj < colsz; ++cj) {
View Full Code Here

  public static List toListHelper(List result, Object arg, boolean skipBoolean, boolean skipText, XelContext ctx){
    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();
        toListHelper(result, cell.getResult(), skipBoolean, skipText, (XelContext) book); // recursive
      }
    } else if (arg instanceof Range[]) { //a range array, iterator thru available ranges
      for (int j = 0; j < ((Range[])arg).length; ++j) {
        final Range rng = (Range) ((Range[])arg)[j];
        final Book book = rng.getSheet().getBook();
        toListHelper(result, rng, skipBoolean, skipText, (XelContext) book); // recursive
      }
    } else if (arg instanceof String) {
      if (!skipText) {
        result.add(Objects.ZERO_DOUBLE);
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.