List of usage examples for org.apache.poi.xssf.usermodel XSSFRow getPhysicalNumberOfCells
@Override public int getPhysicalNumberOfCells()
From source file:mil.tatrc.physiology.datamodel.dataset.DataSetReader.java
License:Apache License
protected static Map<String, SEEnvironmentalConditions> readEnvironments(XSSFSheet xlSheet, Map<String, SESubstance> substances) { String property, value, unit; SESubstance substance = null;//from ww w.j a va 2 s . co m SEEnvironmentalConditions environment; SESubstanceFraction subFrac = null; Map<String, SEEnvironmentalConditions> map = new HashMap<String, SEEnvironmentalConditions>(); List<SEEnvironmentalConditions> environments = new ArrayList<SEEnvironmentalConditions>(); try { int rows = xlSheet.getPhysicalNumberOfRows(); for (int r = 0; r < rows; r++) { XSSFRow row = xlSheet.getRow(r); if (row == null) continue; int cells = row.getPhysicalNumberOfCells(); if (r == 0) {// Allocate the number of environments we have for (int i = 1; i < cells; i++) environments.add(new SEEnvironmentalConditions()); } property = row.getCell(0).getStringCellValue(); if (property == null || property.isEmpty()) continue; if (property.equals("AmbientSubstanceData")) continue; Log.info("Processing Environment Field : " + property); for (int c = 1; c < cells; c++) { String cellValue = null; XSSFCell cell = row.getCell(c); switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_NUMERIC: cellValue = Double.toString(cell.getNumericCellValue()); break; case XSSFCell.CELL_TYPE_STRING: cellValue = cell.getStringCellValue(); break; } if (cellValue == null || cellValue.isEmpty()) continue; int split = cellValue.indexOf(" "); // Pull The Value if (split == -1) { value = cellValue; unit = ""; } else { value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); } environment = environments.get(c - 1); if (property.equals("Name")) { map.put(cellValue, environment); continue; } if (property.equals("Substance")) {// NOTE THIS ASSUMES THAT A ROW IS ALL ASSOCIATED WITH THE SAME SUBSTANCE substance = substances.get(value); continue; } if (substance == null) subFrac = null; else subFrac = environment.getAmbientSubstance(substance, null); if (!setProperty(environment, subFrac, property, value, unit)) { Log.error("Error pulling" + property + " from " + cellValue); break; } } } } catch (Exception ex) { Log.error("Error reading XLS", ex); return null; } return map; }
From source file:mil.tatrc.physiology.datamodel.dataset.DataSetReader.java
License:Apache License
protected static Map<String, SENutrition> readNutrition(XSSFSheet xlSheet) { String property, value, unit; SENutrition meal;// www . j ava 2s .co m Map<String, SENutrition> map = new HashMap<String, SENutrition>(); List<SENutrition> meals = new ArrayList<SENutrition>(); try { int rows = xlSheet.getPhysicalNumberOfRows(); for (int r = 0; r < rows; r++) { XSSFRow row = xlSheet.getRow(r); if (row == null) continue; int cells = row.getPhysicalNumberOfCells(); if (r == 0) {// Allocate the number of environments we have for (int i = 1; i < cells; i++) meals.add(new SENutrition()); } property = row.getCell(0).getStringCellValue(); if (property == null || property.isEmpty()) continue; Log.info("Processing Nutrition Field : " + property); for (int c = 1; c < cells; c++) { String cellValue = null; XSSFCell cell = row.getCell(c); switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_NUMERIC: cellValue = Double.toString(cell.getNumericCellValue()); break; case XSSFCell.CELL_TYPE_STRING: cellValue = cell.getStringCellValue(); break; } if (cellValue == null || cellValue.isEmpty()) continue; int split = cellValue.indexOf(" "); // Pull The Value if (split == -1) { value = cellValue; unit = ""; } else { value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); } meal = meals.get(c - 1); if (property.equals("Name")) { map.put(cellValue, meal); continue; } if (!setProperty(meal, property, value, unit)) { Log.error("Error pulling" + property + " from " + cellValue); break; } } } } catch (Exception ex) { Log.error("Error reading XLS", ex); return null; } return map; }
From source file:mil.tatrc.physiology.utilities.Excel2PDF.java
License:Apache License
public static void convert(String from, String to) throws IOException { FileInputStream xlFile = new FileInputStream(new File(from)); // Read workbook into HSSFWorkbook XSSFWorkbook xlWBook = new XSSFWorkbook(xlFile); //We will create output PDF document objects at this point PDDocument pdf = new PDDocument(); //pdf.addTitle(); for (int s = 0; s < xlWBook.getNumberOfSheets(); s++) { XSSFSheet xlSheet = xlWBook.getSheetAt(s); Log.info("Processing Sheet : " + xlSheet.getSheetName()); PDPage page = new PDPage(PDRectangle.A4); page.setRotation(90);/*from ww w .j a v a2 s. com*/ pdf.addPage(page); PDRectangle pageSize = page.getMediaBox(); PDPageContentStream contents = new PDPageContentStream(pdf, page); contents.transform(new Matrix(0, 1, -1, 0, pageSize.getWidth(), 0));// including a translation of pageWidth to use the lower left corner as 0,0 reference contents.setFont(PDType1Font.HELVETICA_BOLD, 16); contents.beginText(); contents.newLineAtOffset(50, pageSize.getWidth() - 50); contents.showText(xlSheet.getSheetName()); contents.endText(); contents.close(); int rows = xlSheet.getPhysicalNumberOfRows(); for (int r = 0; r < rows; r++) { XSSFRow row = xlSheet.getRow(r); if (row == null) continue; int cells = row.getPhysicalNumberOfCells(); if (cells == 0) continue;// Add an empty Roe } } /* //We will use the object below to dynamically add new data to the table PdfPCell table_cell; //Loop through rows. while(rowIterator.hasNext()) { Row row = rowIterator.next(); Iterator<Cell> cellIterator = row.cellIterator(); while(cellIterator.hasNext()) { Cell cell = cellIterator.next(); //Fetch CELL switch(cell.getCellType()) { //Identify CELL type //you need to add more code here based on //your requirement / transformations case Cell.CELL_TYPE_STRING: //Push the data from Excel to PDF Cell table_cell=new PdfPCell(new Phrase(cell.getStringCellValue())); //feel free to move the code below to suit to your needs my_table.addCell(table_cell); break; } //next line } } */ pdf.save(new File(to)); pdf.close(); xlWBook.close(); xlFile.close(); //close xls }
From source file:org.addition.epanet.network.io.input.ExcelParser.java
License:Open Source License
private int parseWorksheet(Network net, List<XSSFSheet> sheets, Pattern tagPattern, int errSum) throws ENException { for (XSSFSheet sheet : sheets) { boolean lastRowNull = true; boolean lastRowHeader = false; Network.SectType lastType = null; for (int rowCount = 0, tRowId = 0; rowCount < sheet.getPhysicalNumberOfRows(); tRowId++) { XSSFRow row = sheet.getRow(tRowId); if (row != null) { List<String> tokens = new ArrayList<String>(); String comments = ""; boolean allAreBold = true; for (int cellCount = 0, tCellId = 0; cellCount < row.getPhysicalNumberOfCells(); tCellId++) { XSSFCell cell = row.getCell(tCellId); if (cell != null) { String value = convertCell(cell); if (value.startsWith(";")) { comments += value; } else tokens.add(value); allAreBold = allAreBold & cell.getCellStyle().getFont().getBold(); // TODO remover cellCount++;/*from w ww . ja v a2 s .c om*/ } } if (tokens.size() > 0) { if (lastRowNull && tagPattern.matcher(tokens.get(0)).matches()) { lastType = Network.SectType.parse(tokens.get(0)); lastRowHeader = true; } else { String[] tokArray = tokens.toArray(new String[tokens.size()]); if (lastRowHeader && allAreBold) { //System.out.println("Formating Header : " + tokens.toArray(new String[tokens.size()])); } else { try { parseSect(net, lastType, comments, tokArray); } catch (ENException e) { String line = ""; for (String tk : tokArray) line += tk + " "; logException(lastType, e, line, tokArray); errSum++; } } } } lastRowNull = false; rowCount++; } if (row == null || row != null && row.getPhysicalNumberOfCells() == 0) { lastRowNull = true; continue; } } } return errSum; }
From source file:org.apache.ofbiz.pricat.AbstractPricatParser.java
License:Apache License
private void copyRow(XSSFRow sourceRow, XSSFRow targetRow, XSSFCreationHelper factory, XSSFDrawing patriarch) { for (int j = 0; j < sourceRow.getPhysicalNumberOfCells(); j++) { XSSFCell cell = sourceRow.getCell(j); if (cell != null) { XSSFCell newCell = targetRow.createCell(j); int cellType = cell.getCellType(); newCell.setCellType(cellType); switch (cellType) { case XSSFCell.CELL_TYPE_BOOLEAN: newCell.setCellValue(cell.getBooleanCellValue()); break; case XSSFCell.CELL_TYPE_ERROR: newCell.setCellErrorValue(cell.getErrorCellValue()); break; case XSSFCell.CELL_TYPE_FORMULA: newCell.setCellFormula(cell.getCellFormula()); break; case XSSFCell.CELL_TYPE_NUMERIC: newCell.setCellValue(cell.getNumericCellValue()); break; case XSSFCell.CELL_TYPE_STRING: newCell.setCellValue(cell.getRichStringCellValue()); break; default: newCell.setCellValue(formatter.formatCellValue(cell)); }/* w ww . j av a 2 s .co m*/ if (cell.getCellComment() != null) { XSSFClientAnchor anchor = factory.createClientAnchor(); anchor.setDx1(100); anchor.setDx2(100); anchor.setDy1(100); anchor.setDy2(100); anchor.setCol1(newCell.getColumnIndex()); anchor.setCol2(newCell.getColumnIndex() + 4); anchor.setRow1(newCell.getRowIndex()); anchor.setRow2(newCell.getRowIndex() + 4); anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE); XSSFComment comment = patriarch.createCellComment(anchor); comment.setString(cell.getCellComment().getString()); newCell.setCellComment(comment); } newCell.setCellStyle(cell.getCellStyle()); newCell.getSheet().setColumnWidth(newCell.getColumnIndex(), cell.getSheet().getColumnWidth(cell.getColumnIndex())); } } }
From source file:org.apache.ofbiz.pricat.AbstractPricatParser.java
License:Apache License
/** * Get data by version definition.//from w w w .j a va 2 s . c o m * * @param row * @param colNames * @param size * @return */ public List<Object> getCellContents(XSSFRow row, List<Object[]> colNames, int size) { List<Object> results = new ArrayList<Object>(); boolean foundError = false; if (isEmptyRow(row, size, true)) { return null; } for (int i = 0; i < size; i++) { XSSFCell cell = null; if (row.getPhysicalNumberOfCells() > i) { cell = row.getCell(i); } if (cell == null) { if (((Boolean) colNames.get(i)[2]).booleanValue()) { report.print(UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale), InterfaceReport.FORMAT_WARNING); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale)); foundError = true; continue; } else { cell = row.createCell(i); } } int cellType = cell.getCellType(); String cellValue = formatter.formatCellValue(cell); if (UtilValidate.isNotEmpty(cellValue)) { if (cellType == XSSFCell.CELL_TYPE_FORMULA) { cellValue = BigDecimal.valueOf(cell.getNumericCellValue()) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding).toString(); report.print(((i == 0) ? "" : ", ") + cellValue, InterfaceReport.FORMAT_NOTE); } else { report.print(((i == 0) ? "" : ", ") + cellValue, InterfaceReport.FORMAT_NOTE); } } else { report.print(((i == 0) ? "" : ","), InterfaceReport.FORMAT_NOTE); } if (((Boolean) colNames.get(i)[2]).booleanValue() && UtilValidate.isEmpty(cellValue)) { report.print(UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale), InterfaceReport.FORMAT_WARNING); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale)); foundError = true; results.add(null); continue; } if (((Boolean) colNames.get(i)[2]).booleanValue() && cellType != (int) colNames.get(i)[1]) { // String warningMessage = ""; if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_STRING) { results.add(cellValue); } else if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_NUMERIC) { if (cell.getCellType() != XSSFCell.CELL_TYPE_STRING) { cell.setCellType(XSSFCell.CELL_TYPE_STRING); } try { results.add(BigDecimal.valueOf(Double.parseDouble(cell.getStringCellValue())) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } } else { if (UtilValidate.isEmpty(cellValue)) { results.add(null); continue; } if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_STRING) { if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) { results.add(cell.getStringCellValue()); } else { results.add(cellValue); } } else if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_NUMERIC) { if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) { try { results.add(BigDecimal.valueOf(Double.valueOf(cell.getStringCellValue()))); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } else if (cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) { try { results.add(BigDecimal.valueOf(cell.getNumericCellValue()) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } else { try { results.add(BigDecimal.valueOf(Double.valueOf(cellValue)) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } } } } if (foundError) { return null; } return results; }
From source file:org.apache.ofbiz.pricat.AbstractPricatParser.java
License:Apache License
protected boolean isEmptyRow(XSSFRow row, int size, boolean display) { // check whether this row is empty if (UtilValidate.isEmpty(row)) { report.print(UtilProperties.getMessage(resource, "ExcelEmptyRow", locale), InterfaceReport.FORMAT_NOTE); return true; }//from w w w . j a va2s. com boolean isEmptyRow = true; int physicalNumberOfCells = row.getPhysicalNumberOfCells(); int i = 0; for (; i < size; i++) { XSSFCell cell = null; if (physicalNumberOfCells > i) { cell = row.getCell(i); } if (cell != null && UtilValidate.isNotEmpty(formatter.formatCellValue(cell)) && UtilValidate.isNotEmpty(formatter.formatCellValue(cell).trim())) { isEmptyRow = false; break; } } if (isEmptyRow) { if (display) { report.print(UtilProperties.getMessage(resource, "ExcelEmptyRow", locale), InterfaceReport.FORMAT_NOTE); } return true; } else if (!isEmptyRow && i > size) { if (display) { report.print(UtilProperties.getMessage(resource, "IgnoreDataOutOfRange", locale), InterfaceReport.FORMAT_NOTE); } return true; } return isEmptyRow; }
From source file:org.apache.ofbiz.pricat.sample.SamplePricatParser.java
License:Apache License
/** * Get data by version definition.//ww w . ja va 2 s .co m * * @param row * @param colNames * @param size * @return */ public List<Object> getCellContents(XSSFRow row, List<Object[]> colNames, int size) { List<Object> results = new ArrayList<Object>(); boolean foundError = false; if (isEmptyRow(row, size, true)) { return null; } // check and get data for (int i = 0; i < size; i++) { XSSFCell cell = null; if (row.getPhysicalNumberOfCells() > i) { cell = row.getCell(i); } if (cell == null) { if (((Boolean) colNames.get(i)[2]).booleanValue() && (facilities.keySet().size() > 1 || (facilities.keySet().size() == 1 && i >= 2))) { report.print(UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale), InterfaceReport.FORMAT_WARNING); cell = row.createCell(i); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale)); foundError = true; results.add(null); continue; } else { cell = row.createCell(i); } } int cellType = cell.getCellType(); String cellValue = formatter.formatCellValue(cell); if (UtilValidate.isNotEmpty(cellValue) && UtilValidate.isNotEmpty(cellValue.trim())) { if (cellType == XSSFCell.CELL_TYPE_FORMULA) { try { cellValue = BigDecimal.valueOf(cell.getNumericCellValue()) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding).toString(); } catch (IllegalStateException e) { try { cellValue = cell.getStringCellValue(); } catch (IllegalStateException e1) { // do nothing } } report.print(((i == 0) ? "" : ", ") + cellValue, InterfaceReport.FORMAT_NOTE); } else { report.print(((i == 0) ? "" : ", ") + cellValue, InterfaceReport.FORMAT_NOTE); } } else { report.print(((i == 0) ? "" : ","), InterfaceReport.FORMAT_NOTE); } if (((Boolean) colNames.get(i)[2]).booleanValue() && UtilValidate.isEmpty(cellValue) && (facilities.keySet().size() > 1 || (facilities.keySet().size() == 1 && i >= 2))) { report.print(UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale), InterfaceReport.FORMAT_WARNING); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorColCannotEmpty", new Object[] { colNames.get(i)[0] }, locale)); foundError = true; results.add(null); continue; } if (((Boolean) colNames.get(i)[2]).booleanValue() && cellType != (int) colNames.get(i)[1]) { // String warningMessage = ""; if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_STRING) { if (UtilValidate.isNotEmpty(cellValue) && UtilValidate.isNotEmpty(cellValue.trim())) { results.add(cellValue); } else { results.add(null); } } else if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_NUMERIC) { if (cell.getCellType() != XSSFCell.CELL_TYPE_STRING) { cell.setCellType(XSSFCell.CELL_TYPE_STRING); } try { results.add(BigDecimal.valueOf(Double.parseDouble(cell.getStringCellValue())) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } } else { if (UtilValidate.isEmpty(cellValue) || UtilValidate.isEmpty(cellValue.trim())) { results.add(null); continue; } if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_STRING) { if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) { cellValue = cell.getStringCellValue().trim(); results.add(cellValue); } else { results.add(cellValue.trim()); } } else if ((int) colNames.get(i)[1] == XSSFCell.CELL_TYPE_NUMERIC) { if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) { try { results.add(BigDecimal.valueOf(Double.valueOf(cell.getStringCellValue()))); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } else if (cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) { try { results.add(BigDecimal.valueOf(cell.getNumericCellValue()) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } else { try { results.add(BigDecimal.valueOf(Double.valueOf(cellValue)) .setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } } } } } if (foundError) { return null; } return results; }
From source file:ReadExcel.HSSFReadWrite.java
License:Apache License
private static void startReadXlsxFile(String fileName) { try {//from ww w . j ava 2 s .c o m XSSFWorkbook wb = HSSFReadWrite.readxlsxFile(fileName); System.out.println("Data dump:\n"); for (int k = 0; k < wb.getNumberOfSheets(); k++) { XSSFSheet sheet = wb.getSheetAt(k); int rows = sheet.getPhysicalNumberOfRows(); System.out.println("Sheet " + k + " \"" + wb.getSheetName(k) + "\" has " + rows + " row(s)."); for (int r = 0; r < rows; r++) { XSSFRow row = sheet.getRow(r); if (row == null) { continue; } int cells = row.getPhysicalNumberOfCells(); System.out.println("\nROW " + row.getRowNum() + " has " + cells + " cell(s)."); for (int c = 0; c < cells; c++) { XSSFCell cell = row.getCell(c); String value = null; switch (cell.getCellTypeEnum()) { case FORMULA: value = "FORMULA value=" + cell.getCellFormula(); break; case NUMERIC: value = "NUMERIC value=" + cell.getNumericCellValue(); break; case STRING: value = "STRING value=" + cell.getStringCellValue(); break; default: } System.out.println("CELL col=" + cell.getColumnIndex() + " VALUE=" + value); } } } wb.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:singleton.StaticClass.java
public synchronized void copyFromExcel(String fileName) throws IOException { //System.out.println("start"); Data temp;/* w w w . j av a 2s . co m*/ String value = ""; File inFile = new File(fileName); FileInputStream file = new FileInputStream(inFile); XSSFWorkbook wb = new XSSFWorkbook(file); XSSFSheet sheet = wb.getSheetAt(4); // Build Image Analysis page is at // the 4th sheet of Open source // license excel file. int rows = sheet.getPhysicalNumberOfRows(); for (int i = 2; i < rows; ++i) { // start index should be 2 since the // 1st row is used for titles. XSSFRow row = sheet.getRow(i); if (row != null) { int cells = row.getPhysicalNumberOfCells(); // Number of cells // at each row. temp = new Data(); for (int colIndex = 1; colIndex <= cells; colIndex++) { XSSFCell cell = row.getCell(colIndex); if (colIndex == 1) { switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_BLANK: temp.setBinary(""); break; case XSSFCell.CELL_TYPE_STRING: temp.setBinary(cell.getStringCellValue()); break; } } else if (colIndex == 2) { switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_BLANK: temp.setPath(""); break; case XSSFCell.CELL_TYPE_STRING: temp.setPath(cell.getStringCellValue()); break; } } else if (colIndex == 3) { switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_BLANK: temp.setOnok(""); break; case XSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); temp.setOnok(value); break; } } else if (colIndex == 4) { switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_BLANK: temp.setOssComponent(""); break; case XSSFCell.CELL_TYPE_STRING: temp.setOssComponent(cell.getStringCellValue()); break; } } else if (colIndex == 6) { switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_BLANK: temp.setLicense(""); break; case XSSFCell.CELL_TYPE_STRING: temp.setLicense(cell.getStringCellValue()); break; } } else { continue; } } if (temp != null) { if (value.equalsIgnoreCase("nok")) { nokList.add(temp); //System.out.println("nok count : " + nokList.size()); } else if (value.equalsIgnoreCase("ok")) { okList.add(temp); //System.out.println("ok count : " + okList.size()); } else if (value.equalsIgnoreCase("nok(na)")) { nokNaList.add(temp); //System.out.println("nok(na) count : " + nokNaList.size()); } else { blankList.add(temp); //System.out.println("blank count : " + blankList.size()); } System.out.println(temp.getBinary() + "\t" + temp.getPath() + "\t\t" + temp.getOnok() + "\t\t" + temp.getLicense()); } } } }