List of usage examples for org.apache.poi.ss.usermodel Cell getDateCellValue
Date getDateCellValue();
From source file:com.beyondb.io.ExcelControl.java
@Override public Object[][] readTableContent() throws IOException, InvalidFormatException, Exception { try {/*from w w w .j a v a 2 s. com*/ //OPCPackage pkg = OPCPackage.open(file); // InputStream m_InputStream = new FileInputStream(m_File); Sheet sheet = null; // if (!m_InputStream.markSupported()) { // m_InputStream = new PushbackInputStream(m_InputStream, 8); // } // if (POIFSFileSystem.hasPOIFSHeader(m_InputStream)) { // HSSFWorkbook hSSFWorkbook = new HSSFWorkbook(m_InputStream); // sheet = (Sheet)hSSFWorkbook.getSheetAt(0); // // } else if (POIXMLDocument.hasOOXMLHeader(m_InputStream)) { // XSSFWorkbook xSSFWorkbook = new XSSFWorkbook(OPCPackage.open(m_File)); // sheet = (Sheet)xSSFWorkbook.getSheetAt(0); // } // else { // throw new IllegalArgumentException("excel?poi??"); // } sheet = getSheet(); if (sheet != null) { if (sheet.getLastRowNum() == 0) { throw new Exception("Excel"); } //? m_RowNum = sheet.getLastRowNum() + 1; // m_ColumnNum = sheet.getRow(0).getPhysicalNumberOfCells(); m_ColumnNum = sheet.getRow(0).getLastCellNum(); m_TableStr = new Object[m_RowNum][m_ColumnNum]; for (int rindex = 0; rindex < m_RowNum; rindex++) { Row row = sheet.getRow(rindex); for (int cindex = 0; cindex < m_ColumnNum; cindex++) { Cell cell = row.getCell(cindex); if (cell == null) { m_TableStr[rindex][cindex] = ""; } else { String value = ""; switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: // System.out.println(cell.getRichStringCellValue().getString()); value = cell.getRichStringCellValue().getString().replace("\n", ""); break; case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { // System.out.println(cell.getDateCellValue()); value = cell.getDateCellValue().toString(); } else { DecimalFormat df = new DecimalFormat("#"); value = String.valueOf(cell.getNumericCellValue()); double d = cell.getNumericCellValue(); int dInt = (int) d; BigDecimal b1 = new BigDecimal(value); BigDecimal b2 = new BigDecimal(Integer.toString(dInt)); double dPoint = b1.subtract(b2).doubleValue(); if (dPoint == 0) { //? value = df.format(cell.getNumericCellValue()); } } break; case Cell.CELL_TYPE_BOOLEAN: // System.out.println(cell.getBooleanCellValue()); value = cell.getBooleanCellValue() + ""; break; case Cell.CELL_TYPE_FORMULA: // System.out.println(cell.getCellFormula()); value = cell.getCellFormula(); break; case Cell.CELL_TYPE_BLANK: value = ""; default: // System.out.println(); value = ""; } m_TableStr[row.getRowNum()][cell.getColumnIndex()] = value; } } } } } catch (IOException | InvalidFormatException e) { Logger.getLogger(ExcelControl.class.getName()).log(Level.SEVERE, "excel??", e); throw e; } catch (Exception ex) { Logger.getLogger(ExcelControl.class.getName()).log(Level.SEVERE, "excel??", ex); throw ex; } finally { m_InputStream.close(); } return m_TableStr; }
From source file:com.blackducksoftware.tools.commonframework.standard.datatable.reader.DataTableReaderExcel.java
License:Apache License
private void readCell(Record rec, FieldDef fieldDef, Cell cell) throws Exception { if (cell == null) { return;/*from ww w.j a va 2 s . c o m*/ } switch (fieldDef.getType()) { case STRING: String cellStringValue = ""; if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { cellStringValue = String.valueOf(cell.getNumericCellValue()); } else { cellStringValue = cell.getStringCellValue(); } log.debug("String cell; value: " + cellStringValue); rec.setFieldValue(fieldDef.getName(), cellStringValue); break; case DATE: switch (cell.getCellType()) { case Cell.CELL_TYPE_BLANK: break; case Cell.CELL_TYPE_STRING: break; case Cell.CELL_TYPE_NUMERIC: Date cellDateValue = cell.getDateCellValue(); GregorianCalendar cal = new GregorianCalendar(); cal.setTime(cellDateValue); rec.setFieldValue(fieldDef.getName(), cal); break; } break; case HYPERLINK: throw new Exception("DataTableReaderExcel does not yet support HYPERLINK field type"); default: } }
From source file:com.clican.pluto.dataprocess.engine.processes.ExcelProcessor.java
License:LGPL
public void readExcel(ProcessorContext context, ExcelExecBean execBean) throws Exception { InputStream is = new AutoDecisionResource(execBean.getResource()).getInputStream(); try {//from w ww .jav a 2 s . com Workbook book = WorkbookFactory.create(is); Sheet sheet = book.getSheet(execBean.getSheetName()); List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); List<String> names = new ArrayList<String>(); Map<String, String> typeMap = execBean.getTypeMap(); int firstRow = sheet.getFirstRowNum(), lastRow = sheet.getLastRowNum(); for (int rowIdx = firstRow; rowIdx < lastRow; rowIdx++) { Row excelRow = sheet.getRow(rowIdx); short minColIx = excelRow.getFirstCellNum(); short maxColIx = excelRow.getLastCellNum(); Map<String, Object> row = new HashMap<String, Object>(); for (int colIdx = minColIx; colIdx < maxColIx; colIdx++) { Cell cell = excelRow.getCell(colIdx, Row.CREATE_NULL_AS_BLANK); if (rowIdx == 0) { names.add(cell.getStringCellValue()); } else { String type = null; if (names.size() > colIdx) { type = typeMap.get(names.get(colIdx)); } if (StringUtils.isNotEmpty(type)) { if (type.equals("string")) { cell.setCellType(Cell.CELL_TYPE_STRING); row.put(names.get(colIdx), cell.getStringCellValue().trim()); } else if (type.equals("double")) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); row.put(names.get(colIdx), cell.getNumericCellValue()); } else if (type.equals("int")) { cell.setCellType(Cell.CELL_TYPE_NUMERIC); row.put(names.get(colIdx), (int) cell.getNumericCellValue()); } else if (type.equals("date")) { row.put(names.get(colIdx), cell.getDateCellValue()); } else { throw new DataProcessException("??Excel?"); } } } } if (rowIdx != 0) { result.add(row); } } context.setAttribute(execBean.getResultName(), result); } finally { if (is != null) { is.close(); } } }
From source file:com.cms.utils.ExcelReader.java
public static List importExcel(File file, int iSheet, int iBeginRow, int iFromCol, int iToCol, int rowBack) throws FileNotFoundException { List lst = new ArrayList(); FileInputStream flieInput = new FileInputStream(file); HSSFWorkbook workbook;//from w w w . j ava 2 s . c om try { workbook = new HSSFWorkbook(flieInput); HSSFSheet worksheet = workbook.getSheetAt(iSheet); int irowBack = 0; for (int i = iBeginRow; i <= worksheet.getLastRowNum(); i++) { Object[] obj = new Object[iToCol - iFromCol + 1]; Row row = worksheet.getRow(i); if (row != null) { int iCount = 0; int check = 0; for (int j = iFromCol; j <= iToCol; j++) { Cell cell = row.getCell(j); if (cell != null) { switch (cell.getCellType()) { case Cell.CELL_TYPE_STRING: obj[iCount] = cell.getStringCellValue().trim(); break; case Cell.CELL_TYPE_NUMERIC: if (HSSFDateUtil.isCellDateFormatted(cell)) { Date date = cell.getDateCellValue(); obj[iCount] = DateTimeUtils.convertDateToString(date, "dd/MM/yyyy"); } else { Double doubleValue = (Double) cell.getNumericCellValue(); //String.format("%.0f", doubleValue); List<String> lstValue = DataUtil.splitDot(String.valueOf(doubleValue)); if (lstValue.get(1).matches("[0]+")) { obj[iCount] = lstValue.get(0); } else { obj[iCount] = String.format("%.2f", doubleValue).trim(); } } break; case Cell.CELL_TYPE_BLANK: check++; break; } } else { obj[iCount] = null; } iCount += 1; } if (check != (iToCol - iFromCol + 1)) { lst.add(obj); } } else { irowBack += 1; } if (irowBack == rowBack) { break; } } } catch (IOException ex) { lst = null; } return lst; }
From source file:com.cn.util.Units.java
/** * ????/*from ww w . ja v a 2 s. c o m*/ * * @param cell Excel? * @return String ?? */ public static String getDateCellValue(Cell cell) { String result = ""; try { int cellType = cell.getCellType(); if (cellType == Cell.CELL_TYPE_NUMERIC) { Date date = cell.getDateCellValue(); result = (date.getYear() + 1900) + "-" + (date.getMonth() + 1) + "-" + date.getDate(); } else if (cellType == Cell.CELL_TYPE_STRING) { String date = getStringCellValue(cell); result = date.replaceAll("[]", "-").replace("", "").trim(); } else if (cellType == Cell.CELL_TYPE_BLANK) { result = ""; } } catch (Exception e) { System.out.println("??!"); e.printStackTrace(); } return result.trim(); }
From source file:com.cn.util.Units.java
/** * ?Cell?/* w ww. j a v a 2 s . com*/ * * @param cell * @return */ public static String getCellFormatValue(Cell cell) { String cellvalue = ""; if (cell != null) { // ?CellType switch (cell.getCellType()) { // ?CellTypeNUMERIC case Cell.CELL_TYPE_NUMERIC: case Cell.CELL_TYPE_FORMULA: { // ?cell?Date if (DateUtil.isCellDateFormatted(cell)) { // DateData? //1?data?2011-10-12 0:00:00 //cellvalue = cell.getDateCellValue().toLocaleString(); //2?data??2011-10-12 Date date = cell.getDateCellValue(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); cellvalue = sdf.format(date); } // else { // ??Cell cellvalue = String.valueOf(cell.getNumericCellValue()); } break; } // ?CellTypeSTRIN case Cell.CELL_TYPE_STRING: // ??Cell cellvalue = cell.getRichStringCellValue().getString(); break; // Cell default: cellvalue = " "; } } else { cellvalue = ""; } return cellvalue; }
From source file:com.cordys.coe.ac.fileconnector.utils.ExcelRead.java
License:Apache License
/** * Read records from Excel file//from www . j ava2s . c o m * * @param vcConfig The validator configuration object. * @param bUseTupleOld * @param filename Name of the Excel file. * @param doc Document conatins the request. * @param iResponsenode The record XML structure root node, or zero, if only validation is needed. * @param sheetno Sheet index of the Excel file. * @param startrow row index from which data to be read. * @param endrow row index upto which data to be read. * @param startcolumn column index from which data to be read. * @param endcolumn column index upto which data to be read. */ public static void readall(ValidatorConfig vcConfig, Boolean bUseTupleOld, String filename, Document doc, int iResponsenode, int sheetno, int startrow, int endrow, int startcolumn, int endcolumn) throws FileException { Workbook book = null; Sheet sheet; Cell cell; Row row; FileInputStream fileinp = null; String sRecordName = vcConfig.mConfigMap.get("excel").lRecordList.get(0).sRecordName; try { int iRow, iCol, sheetindex, noofsheets; File file = new File(filename); fileinp = new FileInputStream(filename); if (file.exists()) { if (file.getName().substring(file.getName().lastIndexOf(".") + 1).equalsIgnoreCase("xls")) { book = (Workbook) new HSSFWorkbook(fileinp); } else if (file.getName().substring(file.getName().lastIndexOf(".") + 1).equalsIgnoreCase("xlsx")) { book = new XSSFWorkbook(fileinp); } else { //ERROR fileinp.close(); } } else { //ERROR fileinp.close(); } if (sheetno != -1) { sheetindex = sheetno; noofsheets = sheetindex + 1; } else { sheetindex = 0; noofsheets = book.getNumberOfSheets(); } for (; sheetindex < noofsheets; sheetindex++) { sheet = book.getSheetAt(sheetindex); if (endrow == -1) { endrow = sheet.getLastRowNum(); if (startrow == -1) { startrow = 0; } } else { endrow = startrow + endrow - 1; if (endrow > sheet.getLastRowNum()) { endrow = sheet.getLastRowNum(); } } if (endcolumn == -1) { endcolumn = 30; if (startcolumn == -1) { startcolumn = 0; } } for (int i = startrow; i <= endrow; i++) { row = sheet.getRow(i); if (row == null) { int iTup = doc.createElement("tuple", iResponsenode); if (bUseTupleOld) { iTup = doc.createElement("old", iTup); } iRow = doc.createElement(sRecordName, iTup); //Node.setAttribute(iRow, "id", "" + i); ListIterator fieldslist = vcConfig.mConfigMap.get("excel").lRecordList.get(0).lFieldList .listIterator(); while (fieldslist.hasNext()) { FieldType excelfields = (FieldType) fieldslist.next(); String sColumnName = excelfields.sFieldName; iCol = doc.createTextElement(sColumnName, "", iRow); } continue; } int iTup = doc.createElement("tuple", iResponsenode); if (bUseTupleOld) { iTup = doc.createElement("old", iTup); } iRow = doc.createElement(sRecordName, iTup); ListIterator fieldslist = vcConfig.mConfigMap.get("excel").lRecordList.get(0).lFieldList .listIterator(); while (fieldslist.hasNext()) { FieldType excelfields = (FieldType) fieldslist.next(); int iColumnIndex = Integer.parseInt(excelfields.sColumnIndex); cell = row.getCell(iColumnIndex); String sColumnName = excelfields.sFieldName; if (cell == null) { iCol = doc.createTextElement(sColumnName, "", iRow); continue; } switch (cell.getCellType()) { case Cell.CELL_TYPE_BLANK: iCol = doc.createTextElement(sColumnName, "", iRow); break; case Cell.CELL_TYPE_BOOLEAN: iCol = doc.createTextElement(sColumnName, "" + cell.getBooleanCellValue(), iRow); break; case Cell.CELL_TYPE_ERROR: iCol = doc.createTextElement(sColumnName, "", iRow); break; case Cell.CELL_TYPE_FORMULA: iCol = doc.createTextElement(sColumnName, "" + cell.getCellFormula(), iRow); break; case Cell.CELL_TYPE_NUMERIC: if (HSSFDateUtil.isCellDateFormatted(cell)) { SimpleDateFormat simpledateformat = new SimpleDateFormat( "yyyy-MM-dd 'T' HH:mm:ss.S"); iCol = doc.createTextElement(sColumnName, "" + simpledateformat.format(cell.getDateCellValue()), iRow); } else { iCol = doc.createTextElement(sColumnName, "" + cell.getNumericCellValue(), iRow); } break; case Cell.CELL_TYPE_STRING: iCol = doc.createTextElement(sColumnName, "" + cell.getStringCellValue(), iRow); break; default: System.out.println("default"); } } } } } catch (FileNotFoundException e) { throw new FileException(e, LogMessages.FILE_NOT_FOUND); } catch (IOException e) { throw new FileException(e, LogMessages.IOEXCEPTION_WHILE_READING_FILE, filename); } finally { try { fileinp.close(); } catch (IOException ex) { Logger.getLogger(ExcelRead.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.ctb.importdata.ImportSFDataProcessor.java
public static void populateSFDataStrColValue(SalesForceLicenseData sfld, Cell dataCell, Cell headerCell) { //TODO:: Set sf data object from string column value String cellVal = dataCell.getStringCellValue().trim(); if (headerCell.getStringCellValue().equals(Constants.CUSTOMER_ID)) sfld.setCustomerId(Integer.parseInt(cellVal)); else if ((headerCell.getStringCellValue().equals(Constants.OAS_IMPLEMENTATION_ID))) sfld.setOasImplementationId(getStrValWithDesiredLen(cellVal, Constants.OAS_IMPLEMENTATION_ID_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.IMPL_RECORD_TYPE))) sfld.setImplRecordType(getStrValWithDesiredLen(cellVal, Constants.IMPL_RECORD_TYPE_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CUSTOMER_ACCOUNT_NAME))) sfld.setCustomerAccountName(getStrValWithDesiredLen(cellVal, Constants.CUSTOMER_ACCOUNT_NAME_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.ACCOUNT_STATE))) sfld.setAccountState(getStrValWithDesiredLen(cellVal, Constants.ACCOUNT_STATE_SIZE)); // Need to restrict value to 2 characters only else if ((headerCell.getStringCellValue().equals(Constants.ORG_NODE_ID))) sfld.setOrgNodeId(Integer.parseInt(cellVal)); else if ((headerCell.getStringCellValue().equals(Constants.ORG_NODE_NAME))) sfld.setOrgNodeName(getStrValWithDesiredLen(cellVal, Constants.ORG_NODE_NAME_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT_PHONE))) sfld.setContactPhone(getStrValWithDesiredLen(cellVal, Constants.CONTACT_PHONE_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT))) sfld.setContact(getStrValWithDesiredLen(cellVal, Constants.CONTACT_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT_EMAIL))) sfld.setContactEmail(getStrValWithDesiredLen(cellVal, Constants.CONTACT_EMAIL_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CATEGORY_NAME))) sfld.setCategoryName(getStrValWithDesiredLen(cellVal, Constants.CATEGORY_NAME_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CATEGORY_LEVEL))) sfld.setCategoryLevel(Integer.parseInt(cellVal)); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_MODEL))) sfld.setLicenseModel(getStrValWithDesiredLen(cellVal, Constants.LICENSE_MODEL_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_COUNT))) sfld.setLicenseCount(Integer.parseInt(cellVal)); else if ((headerCell.getStringCellValue().equals(Constants.ORDER_QUANTITY))) sfld.setOrderQuantity(Integer.parseInt(cellVal)); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_DISTRIBUTED_TO))) sfld.setLicenseDistributedTo(getStrValWithDesiredLen(cellVal, Constants.LICENSE_DISTRIBUTED_TO_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CREATED_DATE))) sfld.setCreatedDate(dataCell.getDateCellValue()); else if ((headerCell.getStringCellValue().equals(Constants.INTERVAL_NAME))) sfld.setIntervalName(getStrValWithDesiredLen(cellVal, Constants.INTERVAL_NAME_SIZE)); }
From source file:com.ctb.importdata.ImportSFDataProcessor.java
public static void populateSFDataNumericColValue(SalesForceLicenseData sfld, Cell dataCell, Cell headerCell) { //TODO:: Set sf data object from numeric column value Double cellVal = dataCell.getNumericCellValue(); if (headerCell.getStringCellValue().equals(Constants.CUSTOMER_ID)) sfld.setCustomerId(cellVal.intValue()); else if ((headerCell.getStringCellValue().equals(Constants.OAS_IMPLEMENTATION_ID))) sfld.setOasImplementationId(//ww w.ja v a2 s .com getStrValWithDesiredLen(cellVal.toString(), Constants.OAS_IMPLEMENTATION_ID_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.IMPL_RECORD_TYPE))) sfld.setImplRecordType(getStrValWithDesiredLen(cellVal.toString(), Constants.IMPL_RECORD_TYPE_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CUSTOMER_ACCOUNT_NAME))) sfld.setCustomerAccountName( getStrValWithDesiredLen(cellVal.toString(), Constants.CUSTOMER_ACCOUNT_NAME_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.ACCOUNT_STATE))) sfld.setAccountState(getStrValWithDesiredLen(cellVal.toString(), Constants.ACCOUNT_STATE_SIZE));// Need to restrict value to 2 characters only else if ((headerCell.getStringCellValue().equals(Constants.ORG_NODE_ID))) sfld.setOrgNodeId(cellVal.intValue()); else if ((headerCell.getStringCellValue().equals(Constants.ORG_NODE_NAME))) sfld.setOrgNodeName(getStrValWithDesiredLen(cellVal.toString(), Constants.ORG_NODE_NAME_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT_PHONE))) sfld.setContactPhone(getStrValWithDesiredLen(cellVal.toString(), Constants.CONTACT_PHONE_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT))) sfld.setContact(getStrValWithDesiredLen(cellVal.toString(), Constants.CONTACT_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT_EMAIL))) sfld.setContactEmail(getStrValWithDesiredLen(cellVal.toString(), Constants.CONTACT_EMAIL_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CATEGORY_NAME))) sfld.setCategoryName(getStrValWithDesiredLen(cellVal.toString(), Constants.CATEGORY_NAME_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CATEGORY_LEVEL))) sfld.setCategoryLevel(cellVal.intValue()); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_MODEL))) sfld.setLicenseModel(getStrValWithDesiredLen(cellVal.toString(), Constants.LICENSE_MODEL_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_COUNT))) sfld.setLicenseCount(cellVal.intValue()); else if ((headerCell.getStringCellValue().equals(Constants.ORDER_QUANTITY))) sfld.setOrderQuantity(cellVal.intValue()); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_DISTRIBUTED_TO))) sfld.setLicenseDistributedTo( getStrValWithDesiredLen(cellVal.toString(), Constants.LICENSE_DISTRIBUTED_TO_SIZE)); else if ((headerCell.getStringCellValue().equals(Constants.CREATED_DATE))) sfld.setCreatedDate(dataCell.getDateCellValue()); else if ((headerCell.getStringCellValue().equals(Constants.INTERVAL_NAME))) sfld.setIntervalName(getStrValWithDesiredLen(cellVal.toString(), Constants.INTERVAL_NAME_SIZE)); }
From source file:com.ctb.importdata.ImportSFDataProcessor.java
public static void populateSFDataBlankColValue(SalesForceLicenseData sfld, Cell dataCell, Cell headerCell) { //TODO:: Set sf data object with blank column value String cellVal = " "; if (headerCell.getStringCellValue().equals(Constants.CUSTOMER_ID)) sfld.setCustomerId(new Integer(0)); else if ((headerCell.getStringCellValue().equals(Constants.OAS_IMPLEMENTATION_ID))) sfld.setOasImplementationId(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.IMPL_RECORD_TYPE))) sfld.setImplRecordType(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CUSTOMER_ACCOUNT_NAME))) sfld.setCustomerAccountName(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.ACCOUNT_STATE))) sfld.setAccountState(cellVal);//from www . j a va2 s . com else if ((headerCell.getStringCellValue().equals(Constants.ORG_NODE_ID))) sfld.setOrgNodeId(new Integer(0)); else if ((headerCell.getStringCellValue().equals(Constants.ORG_NODE_NAME))) sfld.setOrgNodeName(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT_PHONE))) sfld.setContactPhone(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT))) sfld.setContact(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CONTACT_EMAIL))) sfld.setContactEmail(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CATEGORY_NAME))) sfld.setCategoryName(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CATEGORY_LEVEL))) sfld.setCategoryLevel(null); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_MODEL))) sfld.setLicenseModel(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_COUNT))) sfld.setLicenseCount(null); else if ((headerCell.getStringCellValue().equals(Constants.ORDER_QUANTITY))) sfld.setOrderQuantity(null); else if ((headerCell.getStringCellValue().equals(Constants.LICENSE_DISTRIBUTED_TO))) sfld.setLicenseDistributedTo(cellVal); else if ((headerCell.getStringCellValue().equals(Constants.CREATED_DATE))) sfld.setCreatedDate(dataCell.getDateCellValue()); else if ((headerCell.getStringCellValue().equals(Constants.INTERVAL_NAME))) sfld.setIntervalName(cellVal); }