Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.DataFormat


      } else if (val instanceof Double) {
        cell.setCellValue((Double) val);
      } else if (val instanceof Float) {
        cell.setCellValue((Float) val);
      } else if (val instanceof Date) {
        DataFormat format = wb.createDataFormat();
              style.setDataFormat(format.getFormat("yyyy-MM-dd"));
        cell.setCellValue((Date) val);
      } else {
        if (fieldType != Class.class){
          cell.setCellValue((String)fieldType.getMethod("setValue", Object.class).invoke(null, val));
        }else{
View Full Code Here


    private CellStyle warningStyle;

    public ExcelCellStyles(Workbook wb) {
        CreationHelper helper = wb.getCreationHelper();
        DataFormat fmt = helper.createDataFormat();

        dateStyle = wb.createCellStyle();
        dateStyle.setDataFormat(fmt.getFormat("yyyy-mm-dd hh:mm:ss"));

        headerStyle = wb.createCellStyle();
        Font headerFont = wb.createFont();
        headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        headerStyle.setFont(headerFont);
View Full Code Here

  }

  static void applyFormatTo(Cell cell, String string) {
    Workbook wb = workbookOf(cell);
    CellStyle style = cell.getCellStyle();
    DataFormat df = wb.createDataFormat();
    style.setDataFormat(df.getFormat(string));
  }
View Full Code Here

  public static WorkbookXlsBuilder newWorkbookXls() {
    return new WorkbookXlsBuilder();
  }

  static void applyFormatTo(Workbook wb, CellStyle style, String formatString) {
    DataFormat df = wb.createDataFormat();
    style.setDataFormat(df.getFormat(formatString));
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.DataFormat

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.