Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Book


    String[] list = constraint.getExplicitListValues();
    if (list != null) {
      return list;
    }
    String txt = constraint.getFormula1();
    Book book = sheet.getBook();
    final ValueEval ve = BookHelper.evaluateFormulaValueEval(book, book.getSheetIndex(sheet), txt, true);
    if (ve instanceof AreaEval) {
      final AreaEval ae = (AreaEval) ve;
      if (ae.isColumn() || ae.isRow()) {
        Worksheet worksheet = null;
        if (ae instanceof LazyAreaEval) {
          worksheet = book.getWorksheet(((LazyAreaEval) ve).getSheetName());
        } else {
          worksheet = sheet;
        }
       
        final int rows = ae.getHeight();
View Full Code Here


        }
      }
      return false;
    } else {
      String txt = constraint.getFormula1();
      Book book = sheet.getBook();
      final ValueEval ve = BookHelper.evaluateFormulaValueEval(book, book.getSheetIndex(sheet), txt, false);
      if (ve instanceof ArrayEval) {
        final ArrayEval ae = (ArrayEval) ve;
        if (ae.isColumn() || ae.isRow()) {
          final int rows = ae.getHeight();
          final int cols = ae.getWidth();
          for (int r = 0; r < rows; ++r) {
            for (int c = 0; c < cols; ++c) {
              ValueEval xve = ae.getValue(r, c);
              final CellValue candidate = book.getFormulaEvaluator().getCellValueByValueEval(xve);
              if (equalCellValue(target, candidate)) {
                return true;
              }
            }
          }
        }
      } else {
        final CellValue candidate = book.getFormulaEvaluator().getCellValueByValueEval(ve);
        if (equalCellValue(target, candidate)) {
          return true;
        }
      }
      return false;
View Full Code Here

        return null;
      }
    }
    //get new evaluated formula value
    if (cellType == Cell.CELL_TYPE_FORMULA) {
      final Book book = sheet.getBook();
      final int sheetIndex = book.getSheetIndex(sheet);
      final CellValue cv = BookHelper.evaluateFormula(book, sheetIndex, (String) value);
      value = BookHelper.getValueByCellValue(cv);
      cellType = cv.getCellType();
    }
    //start validation
View Full Code Here

   * @param sheet sheet to set background color
   * @param rect selection range
   * @param color color to use
   */
  public static void setBackgroundColor(Worksheet sheet, Rect rect, String color) {
    final Book book  = (Book) sheet.getWorkbook();
    final Color bsColor = BookHelper.HTMLToColor(book, color);
    for (int row = rect.getTop(); row <= rect.getBottom(); row++)
      for (int col = rect.getLeft(); col <= rect.getRight(); col++) {
        Cell cell = Utils.getOrCreateCell(sheet, row, col);
        CellStyle cs = cell.getCellStyle();
        final Color srcColor = cs.getFillForegroundColorColor();
        if (Objects.equals(srcColor, bsColor)) {
          continue;
        }
        CellStyle newCellStyle = book.createCellStyle();
        newCellStyle.cloneStyleFrom(cs);
       
        //bug#ZSS-34: cell background color does not show in excel
        //20110819, henrichen@zkoss.org: set color to a cell shall change its fillPattern to "solid" automatically
        final short patternType = cs.getFillPattern();
View Full Code Here

  public static void copyCell(Cell cell, Worksheet dstSheet, int dstRow, int dstCol) {
    copyCell((Worksheet)cell.getSheet(), cell.getRowIndex(), cell.getColumnIndex(), dstSheet, dstRow, dstCol);
  }
 
  public static void insertRows(Worksheet sheet, int startRow, int endRow) {
    final Book book = (Book)sheet.getWorkbook();
    final Range rng = getRange(sheet, startRow, 0, endRow, book.getSpreadsheetVersion().getLastColumnIndex());
    rng.insert(Range.SHIFT_DEFAULT, Range.FORMAT_LEFTABOVE);
  }
View Full Code Here

    final Range rng = getRange(sheet, startRow, 0, endRow, book.getSpreadsheetVersion().getLastColumnIndex());
    rng.insert(Range.SHIFT_DEFAULT, Range.FORMAT_LEFTABOVE);
  }

  public static void deleteRows(Worksheet sheet, int startRow, int endRow) {
    final Book book = (Book)sheet.getWorkbook();
    final Range rng = getRange(sheet, startRow, 0, endRow, book.getSpreadsheetVersion().getLastColumnIndex());
    rng.delete(Range.SHIFT_DEFAULT);
  }
View Full Code Here

    final Range rng = getRange(sheet, startRow, 0, endRow, book.getSpreadsheetVersion().getLastColumnIndex());
    rng.delete(Range.SHIFT_DEFAULT);
  }

  public static void insertColumns(Worksheet sheet, int startCol, int endCol) {
    final Book book = (Book)sheet.getWorkbook();
    final Range rng = getRange(sheet, 0, startCol, book.getSpreadsheetVersion().getLastRowIndex(), endCol);
    rng.insert(Range.SHIFT_DEFAULT, Range.FORMAT_LEFTABOVE);
  }
View Full Code Here

    final Range rng = getRange(sheet, 0, startCol, book.getSpreadsheetVersion().getLastRowIndex(), endCol);
    rng.insert(Range.SHIFT_DEFAULT, Range.FORMAT_LEFTABOVE);
  }

  public static void deleteColumns(Worksheet sheet, int startCol, int endCol) {
    final Book book = (Book)sheet.getWorkbook();
    final Range rng = getRange(sheet, 0, startCol, book.getSpreadsheetVersion().getLastRowIndex(), endCol);
    rng.delete(Range.SHIFT_DEFAULT);
  }
View Full Code Here

    return destination;
  }
 
  public static void setFontColor(Worksheet sheet, int row, int col, String color){
    final Cell cell = Utils.getOrCreateCell(sheet,row,col);
    final Book book = (Book) sheet.getWorkbook();
    final short fontIdx = cell.getCellStyle().getFontIndex();
    final Font font = book.getFontAt(fontIdx);
    final Color orgColor = BookHelper.getFontColor(book, font);
    final Color newColor = BookHelper.HTMLToColor(book, color);
    if (orgColor == newColor || orgColor != null && orgColor.equals(newColor)) {
      return;
    }
View Full Code Here

    cell.setCellStyle(style);
  }
 
  public static void setFillColor(Worksheet sheet, int row, int col, String color){
    final Cell cell = Utils.getOrCreateCell(sheet,row,col);
    final Book book = (Book) sheet.getWorkbook();
    final Color orgColor = cell.getCellStyle().getFillForegroundColorColor();
    final Color newColor = BookHelper.HTMLToColor(book, color);
    if (orgColor == newColor || orgColor != null  && orgColor.equals(newColor)) { //no change, skip
      return;
    }
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.