Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Row.createCell()


            }
            Cell title = titleRow.createCell(index);
            title.setCellStyle(info.titleStyle);
            title.setCellValue(property.getName().identifier);

            Cell value = valueRow.createCell(index);
            value.setCellStyle(info.dataStyle);
            if (property.getType() instanceof BasicType) {
                BasicType type = (BasicType) property.getType();
                switch (type.getKind()) {
                case DATE:
View Full Code Here


     
      int lastColumn = sheet.getRow(0).getPhysicalNumberOfCells();     
      for (int cn=0; cn<lastColumn; cn++) {
        Cell cell = row.getCell(cn, Row.RETURN_BLANK_AS_NULL);
        if (cell == null) {
          cell = row.createCell(cn);
          cell.setCellType(Cell.CELL_TYPE_STRING);
          cell.setCellValue(argument[cn]);
        }
      }
     
View Full Code Here

    final Column[] columns = getColumns();
    for (int i = 0; i < columns.length; i++) {
      Object value = values[i];
      if (value != null) {
        int columnNumber = columns[i].getColumnNumber();
        Cell cell = row.createCell(columnNumber);

        // use a lazyref and the isFetched method to only create style
        // if nescesary
        LazyRef<CellStyle> cellStyle = new LazyRef<CellStyle>() {
          @Override
View Full Code Here

            final Row row = sheet.createRow(zeroBasedLineNumber);
            final Column[] columns = table.getColumns();
            for (int i = 0; i < columns.length; i++) {
                final Column column = columns[i];
                final int columnNumber = column.getColumnNumber();
                row.createCell(columnNumber).setCellValue(column.getName());
            }
        }

        final MutableSchema schema = (MutableSchema) table.getSchema();
        schema.addTable((MutableTable) table);
View Full Code Here

    Comment cc5 = r5.getCell(2).getCellComment();
    cc5.setAuthor("Apache POI");
    cc5.setString(new XSSFRichTextString("Hello!"));
   
    Row r2s2 = sheet2.createRow(2);
    Cell c1r2s2 = r2s2.createCell(1);
    assertNull(c1r2s2.getCellComment());
   
    Comment cc2 = sheet2.createComment();
    cc2.setAuthor("Also POI");
    cc2.setString(new XSSFRichTextString("A new comment"));
View Full Code Here

      maxCol = (maxCol >= oldRow.getLastCellNum() - 1? maxCol : oldRow.getLastCellNum() -1 );
      for(int col = 0; col < oldRow.getLastCellNum(); col ++){
        Cell oldCell = oldRow.getCell(col);
        if(oldCell == null) continue;
        Cell newCell = newRow.getCell(col);
        if(newCell == null) newCell = newRow.createCell(col);       
        copyCell(oldCell, newCell, true);
      }
    }
    for(int col=0; col<=maxCol; col++){
      if(sheet.getColumnWidth(col) >=0)
View Full Code Here

      }
      for(int col=startCol; col<=endCol; col++){
        Cell oldCell = oldRow.getCell(col);
        if(oldCell == null) continue;
        Cell newCell = newRow.getCell(col + colOffset);
        if(newCell == null) newCell = newRow.createCell(col + colOffset);       
        copyCell(oldCell, newCell, copyStyle, rowOffset,colOffset);
      }
    }
    for(int col=startCol; col<=endCol; col++){
      if(sheet.getColumnWidth(col) >=0)
View Full Code Here

      for(int c = startColIndex; c <= endColIndex; c ++){
        String cIdx = ExcelUtil.offsetCellIndex(cellIndex, rowIndex-startRowIndex, c - startColIndex);
        CellStyle style = styleMap.get(cIdx);
        if(style == null) continue;
        Cell cell = row.getCell(c);
        if(cell == null) cell = row.createCell(c)
        cell.setCellStyle(style);
      }
    }
  }
 
View Full Code Here

  private void setCellStyle(Sheet sheet, int rowIndex, int cellIndex, CellStyle style){
    if(style == null) return;
    Row row = sheet.getRow(rowIndex);
    if(row == null) row = sheet.createRow(rowIndex);
    Cell cell = row.getCell(cellIndex);
    if(cell == null) cell = row.createCell(cellIndex);     
    if(cell.getCellStyle() == null || (cell.getCellType() != Cell.CELL_TYPE_NUMERIC)
        || (!DateUtil.isCellDateFormatted(cell))
        || DateUtil.isADateFormat(style.getDataFormat(), style.getDataFormatString()))
      cell.setCellStyle(style);
    else{     
View Full Code Here

  private void setCellValue(Sheet sheet, int rowIndex, int cellIndex, String dataName, OgnlStack stack){
    if(dataName.equals("#")) return;
    Row row = sheet.getRow(rowIndex);
    if(row == null) row = sheet.createRow(rowIndex);
    Cell cell = row.getCell(cellIndex);
    if(cell == null) cell = row.createCell(cellIndex);   
    if(dataName.startsWith("=")){
      //formula
      cell.setCellFormula(dataName.substring(1));
    }else{
      //data
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.