Examples of HSSFDataFormatter


Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

            if(HSSFDateUtil.isCellDateFormatted(cellData)){
              Date xlDtVal=cellData.getDateCellValue();
              cell.setCellValue(new HSSFRichTextString(CommonUtilities.getDateInddMMYYYYFormat(xlDtVal)));
              break;
            }else{
              HSSFDataFormatter format = new HSSFDataFormatter(); // copies the data in the same format
              cell.setCellValue(new HSSFRichTextString(format.formatCellValue(cellData)));
            }
            break;
          }
        }
      }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

//                        td.text(strValue);
                      }else{
                        HSSFCellStyle cellStyle = hssfCell.getCellStyle();
                        if(cellStyle!=null && cellStyle.getDataFormatString()!=null){
//                          String dataFmt = cellStyle.getDataFormatString();
                          strValue = new HSSFDataFormatter().formatRawCellContents(hssfCell.getNumericCellValue(), cellStyle.getDataFormat(), cellStyle.getDataFormatString());
                        }else{
                          strValue = String.valueOf(hssfCell.getNumericCellValue());
                        }
                      }
                    }else{
                      XSSFCell xssfCell = (XSSFCell)cell;
                      if(HSSFDateUtil.isCellDateFormatted(cell)){
                          String dateFmt = cell.getCellStyle().getDataFormatString();
                          /* strValue = new SimpleDateFormat(dateFmt).format(date); - won't work as
                          Java fmt differs from Excel fmt. If Excel date format is mm/dd/yyyy, Java
                          will always be 00 for date since "m" is minutes of the hour.*/
                          strValue = new CellDateFormatter(dateFmt).format(cell.getDateCellValue());
//                        td.text(strValue);
                      }else{
                        XSSFCellStyle cellStyle = xssfCell.getCellStyle();
                        if(cellStyle!=null && cellStyle.getDataFormatString()!=null){
//                           String dateFmt = cell.getCellStyle().getDataFormatString();
                              /* strValue = new SimpleDateFormat(dateFmt).format(date); - won't work as
                              Java fmt differs from Excel fmt. If Excel date format is mm/dd/yyyy, Java
                              will always be 00 for date since "m" is minutes of the hour.*/
                           strValue = new HSSFDataFormatter().formatRawCellContents(cell.getNumericCellValue(), cellStyle.getDataFormat(), cellStyle.getDataFormatString());
                        }else{
                            strValue = String.valueOf(xssfCell.getNumericCellValue());
                        }
//                        xssfCell.getCellStyle().getDataFormatString();
//                        td.text(String.valueOf(cell.getNumericCellValue()));
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

    style = wb.createCellStyle();
    HSSFDataFormat fmt = wb.createDataFormat();
    style.setDataFormat(fmt.getFormat("hh:mm:ss"));

    cell11 = sheet.createRow(0).createCell(0);
    form = new HSSFDataFormatter();

    evaluator = new HSSFFormulaEvaluator(wb);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

  private boolean _includeHeadersFooters = true;

  public ExcelExtractor(HSSFWorkbook wb) {
    super(wb);
    _wb = wb;
    _formatter = new HSSFDataFormatter();
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

   * the given locale for the formats.
   */
  public FormatTrackingHSSFListener(
      HSSFListener childListener, Locale locale) {
    _childListener = childListener;
    _formatter = new HSSFDataFormatter(locale);
    _defaultFormat = NumberFormat.getInstance(locale);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

   * the given locale for the formats.
   */
  public FormatTrackingHSSFListener(
      HSSFListener childListener, Locale locale) {
    _childListener = childListener;
    _formatter = new HSSFDataFormatter(locale);
    _defaultFormat = NumberFormat.getInstance(locale);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

  private boolean _includeHeadersFooters = true;
 
  public ExcelExtractor(HSSFWorkbook wb) {
    super(wb);
    _wb = wb;
    _formatter = new HSSFDataFormatter();
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

  private boolean _includeHeadersFooters = true;
 
  public ExcelExtractor(HSSFWorkbook wb) {
    super(wb);
    _wb = wb;
    _formatter = new HSSFDataFormatter();
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

    style = wb.createCellStyle();
    HSSFDataFormat fmt = wb.createDataFormat();
    style.setDataFormat(fmt.getFormat("hh:mm:ss"));

    cell11 = sheet.createRow(0).createCell(0);
    form = new HSSFDataFormatter();

    evaluator = new HSSFFormulaEvaluator(wb);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFDataFormatter

    style = wb.createCellStyle();
    HSSFDataFormat fmt = wb.createDataFormat();
    style.setDataFormat(fmt.getFormat("hh:mm:ss"));

    cell11 = sheet.createRow(0).createCell(0);
    form = new HSSFDataFormatter();

    evaluator = new HSSFFormulaEvaluator(wb);
  }
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.