Package org.zkoss.poi.ss.usermodel

Examples of org.zkoss.poi.ss.usermodel.Cell


  }
 
  private class HyperlinkSetter extends ValueSetter {
    protected Set<Ref>[] setCellValue(int row, int col, RefSheet refSheet, Object value) {
      final HyperlinkContext context = (HyperlinkContext)value;
      final Cell cell = BookHelper.getOrCreateCell(_sheet, row, col);
      BookHelper.setCellHyperlink(cell, context.getLinktype(), context.getAddress());
      return null; //not need to return Set<Ref>, setHyperlink will call setEditText() and it will do the update
    }
View Full Code Here


      if (i == last)
        return -1;
     
      boolean found = false;
      for (i += 1; i <= last; i++) {
        Cell next = row.getCell(i);
        if (next != null && next.getCellType() != Cell.CELL_TYPE_BLANK) {
          found = true;
          i--;//back to previous empty cell
          break;
        }
      }
View Full Code Here

        updateText = (updateAll || type == CellAttribute.TEXT),
        updateStyle = (updateAll || type == CellAttribute.STYLE),
        updateSize = (updateAll || type == CellAttribute.SIZE),
        updateMerge = (updateAll || type == CellAttribute.MERGE);
     
      Cell cell = Utils.getCell(sheet, row, col);
      JSONObject attrs = new JSONObject();
     
      //row num, cell num attr
//      if (cell != null) {
//        attrs.put("r", row);
//        attrs.put("c", col);
//      }
     
      //merge
      MergeIndex mergeIndex = mergeAggregation.add(row, col);
      if (updateMerge && mergeIndex != null) {
        attrs.put("mi", mergeIndex.getMergeId());
        attrs.put("mc", mergeIndex.getMergeCSSId());
      }
     
      //width, height id
      if (updateSize) {
        if (cell != null) {
          //process overflow when cell type is string, halign is left, no wrap, no merge
          CellStyle cellStyle = cell.getCellStyle();
          if (cell.getCellType() == Cell.CELL_TYPE_STRING &&
            mergeIndex == null && !cellStyle.getWrapText() &&
            BookHelper.getRealAlignment(cell) == CellStyle.ALIGN_LEFT) {
           
            attrs.put("ovf", 1); //1 stand for true
            int c = getMaxOverflowableCellIndex(cell, sheet.getRow(row));
            if (c != col) {
              attrs.put("moc", c);
            }
          }
        }
      }
     
      //style attr
      if (updateStyle) {
        CellFormatHelper cfh = new CellFormatHelper(sheet, row, col, getMergeMatrixHelper(sheet));
        String style = cfh.getHtmlStyle();
        if (!Strings.isEmpty(style)) {
          int idx = styleAggregation.add(style);
          attrs.put("s", idx);
        }
        String innerStyle = cfh.getInnerHtmlStyle();
        if (!Strings.isEmpty(innerStyle)) {
          int idx = styleAggregation.add(innerStyle);
          attrs.put("is", idx);
        }
        if (cfh.hasRightBorder()) {
          attrs.put("rb", 1);
        }
      }
     
      if (cell != null) {
        int cellType = cell.getCellType();
        if (cellType != Cell.CELL_TYPE_BLANK)
          attrs.put("ct", cellType);
       
        if (updateText) {
          if (cellType != Cell.CELL_TYPE_BLANK) {
            final String cellText = getCelltext(sheet, row, col);
            final String editText = getEdittext(sheet, row, col);
            final String formatText = getCellFormatText(sheet, row, col);
           
            if (Objects.equals(cellText, editText) && Objects.equals(editText, formatText)) {
              attrs.put("meft", textAggregation.add(cellText));
            } else {
              attrs.put("t", textAggregation.add(cellText));
              attrs.put("et", textAggregation.add(editText));
              attrs.put("ft", textAggregation.add(formatText));
            }
          }
        }
       
        if (updateStyle) {
          CellStyle cellStyle = cell.getCellStyle();
          boolean locked = cellStyle.getLocked();
          if (!locked)
            attrs.put("l", "f"); //f stand for "false"
         
          boolean wrap = cellStyle.getWrapText();
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null)
          return BookHelper.getHyperlink(cell);
      }
      return null;
    }
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null)
          return BookHelper.getText(cell);
      }
      return null;
    }
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null)
          return BookHelper.getFormatText(cell);
      }
      return null;
    }
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null) {
          return BookHelper.getRichEditText(cell);
        }
      }
      return null;
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
        if (cell != null) {
          return BookHelper.getEditText(cell);
        }
      }
      return null;
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
       
        final Object[] values = BookHelper.editTextToValue(txt, cell);
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
       
        final int cellType = values == null ? -1 : ((Integer)values[0]).intValue();
View Full Code Here

      Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final RefSheet refSheet = ref.getOwnerSheet();
        final Cell cell = getCell(tRow, lCol, refSheet);
       
        final Object[] values = BookHelper.editTextToValue(txt, cell);
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
       
        final int cellType = values == null ? -1 : ((Integer)values[0]).intValue();
View Full Code Here

TOP

Related Classes of org.zkoss.poi.ss.usermodel.Cell

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.