List of usage examples for org.apache.poi.xssf.usermodel XSSFSheet getRow
@Override public XSSFRow getRow(int rownum)
From source file:Logica.L_POIExcel.java
public void Servic_Realizados() throws Exception { JFileChooser selector = new JFileChooser(); selector.setFileFilter(new FileNameExtensionFilter("Excel 2010 or Superior", "xlsx")); //selector.setFileFilter(new FileNameExtensionFilter("Excel with Macrs", "xlsm")); String sSql = ""; String sSql1 = ""; String sSql2 = ""; String sSql3 = ""; String sSql4 = ""; String sSql5 = ""; String sSql6 = ""; String sSql7 = ""; String sSql8 = ""; String UPS_Monitoreados = ""; String BYF = ""; sSql = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%SISE%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; sSql1 = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%BYF%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; sSql2 = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%GE%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; sSql3 = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%EM%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; sSql4 = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%GATM%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; sSql5 = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%SOD%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; sSql6 = "SELECT count(Nro_OT) FROM otinformacion_prb WHERE FechaReporte like '%/08/2016%' and Proveedor_Item like '%TEC%' and (Estado_Servic like '%CC%' or Estado_Servic like '%CS%')"; try {//from w w w . j a va 2 s . c om Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sSql); rs.next(); UPS_Monitoreados = rs.getString("Count(Nro_OT)"); ResultSet rs1 = st.executeQuery(sSql1); rs1.next(); BYF = rs1.getString("Count(Nro_OT)"); } catch (Exception e) { } String directorio = ""; String extension = ""; boolean seleccion = false; int resultado = selector.showOpenDialog(null); switch (resultado) { case JFileChooser.APPROVE_OPTION: directorio = selector.getSelectedFile().getPath(); int i = directorio.lastIndexOf('.'); if (i >= 0) { extension = directorio.substring(i + 1); } seleccion = true; JOptionPane.showMessageDialog(null, "Seleccionaste" + directorio); break; case JFileChooser.CANCEL_OPTION: seleccion = false; JOptionPane.showMessageDialog(null, "No seleccionaste un archivo"); break; case JFileChooser.ERROR_OPTION: seleccion = false; JOptionPane.showMessageDialog(null, "Ocurreo un Error"); break; default: break; } if (extension.equals("xlsx")) { //Leer el archivo de Excel XLSX FileInputStream entrada = new FileInputStream(new File(directorio)); //Acceso al libro de trabajo XSSFWorkbook xlsx = new XSSFWorkbook(entrada); //Acceso a la hoja de trabajo XSSFSheet hoja = xlsx.getSheetAt(0); //Declaracion de fila y celda Row fila = null; Cell celda = null; try { //Asignando a valores a celdas con valores fila = hoja.getRow(1); celda = fila.getCell(8); celda.setCellValue(Integer.parseInt(UPS_Monitoreados)); fila = hoja.getRow(2); celda = fila.getCell(8); celda.setCellValue(Integer.parseInt(BYF)); } catch (NullPointerException NPE) { //En caso de que las celdas esten vacias hay que crearlas fila = hoja.createRow(0); celda = fila.createCell(0); celda.setCellValue(2); celda = fila.createCell(1); celda.setCellValue(6); fila = hoja.createRow(1); celda = fila.createCell(0); celda.setCellValue(9); celda = fila.createCell(1); celda.setCellValue(3); } //Evaluando formulas de todo el libro de excel XSSFFormulaEvaluator.evaluateAllFormulaCells(xlsx); //Cerrando la entrada archivo entrada.close(); //Abriendo archivo para escritura FileOutputStream salida = new FileOutputStream(new File(directorio)); //write changes xlsx.write(salida); //close the stream salida.close(); } }
From source file:lp.XLSXhandler.java
public Object[] opener(File uploaded, String name) { double[][] data = new double[0][0]; String[] dmuNames = new String[0]; String[] variable_names = new String[0]; Object[] obj = new Object[5]; try {//w ww . j a v a 2s .co m OPCPackage pkg = OPCPackage.open(uploaded); XSSFWorkbook wb = new XSSFWorkbook(pkg); XSSFSheet sheet1 = wb.getSheetAt(0); //I find the number of the rows in the file! (0-based) int rows = sheet1.getLastRowNum(); System.out.println("Total Rows of DATA in the file: " + rows); //I find the number of columns! (1-based) int columns = sheet1.getRow(0).getLastCellNum(); System.out.println("Total Columns of DATA in the file: " + columns); data = new double[rows][columns - 1]; dmuNames = new String[rows]; variable_names = new String[columns]; Row row_trav; Cell cell_trav; // Retrieve data from file to array for (int i = 0; i <= rows; i++) { row_trav = sheet1.getRow(i); for (int k = 0; k < columns; k++) { cell_trav = row_trav.getCell(k); if (i == 0) { //we are at line 0 of the uploaded file variable_names[k] = cell_trav.getStringCellValue(); } if (k == 0 && i < rows) { //we are at column 0 of the uploaded file Row row_name = sheet1.getRow(i + 1); cell_trav = row_name.getCell(0); dmuNames[i] = cell_trav.getStringCellValue(); } if (i > 0 && k > 0) { data[i - 1][k - 1] = cell_trav.getNumericCellValue(); } } } obj[0] = data; obj[1] = rows; obj[2] = columns; obj[3] = variable_names; obj[4] = dmuNames; } catch (InvalidFormatException e) { } catch (IOException e) { } return obj; }
From source file:lp.XLSXhandler.java
public boolean fileformat(File uploaded) { boolean f = true; try {//from w ww. j a va2 s . co m OPCPackage pkg = OPCPackage.open(uploaded); XSSFWorkbook wb = new XSSFWorkbook(pkg); XSSFSheet sheet1 = wb.getSheetAt(0); //I find the number of the rows in the file! (0-based) int rows = sheet1.getLastRowNum() + 1; //I find the number of columns! (1-based) int columns = sheet1.getRow(0).getLastCellNum(); /* * I will check only the data part! not the names of the DMUs */ Row row_check; Cell cell_check; for (int i = 1; i < rows; i++) { row_check = sheet1.getRow(i); for (int k = 1; k < columns; k++) { cell_check = row_check.getCell(k); /*If there is something else exept a number (0) * or excel function (2) */ int current = cell_check.getCellType(); if (current == 0 || current == 2) { } else { f = false; } } } } catch (InvalidFormatException e) { e.getMessage(); new Lp_first().cleanDir(); } catch (IOException e) { } return f; }
From source file:machinetoolstore.core.util.ExcelParser.java
public ThreeRollMill doExcelParse(String fileName) { String filePath = UPLOAD_LOCATION + fileName; File importFile = new File(filePath); ThreeRollMill entity = new ThreeRollMill(); try (FileInputStream fis = new FileInputStream(importFile)) { int counter = 0; XSSFWorkbook xssf = new XSSFWorkbook(fis); XSSFSheet xssfSheet = xssf.getSheetAt(0); entity.setCommonId((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setType(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setModel(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setBrand(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setManufacturer(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setMachineState(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setYearOfIssue((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setLocation(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setSales(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setMaterialThickness((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMaterialWidth((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setBendingSpeed(xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMinDiameterMaxBend((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setTopRollDiameter((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMiddleRollDiameter((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setDistanceOfBottomTwoRolls((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMaterialProofStress((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMainEnginePower(xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMachineDimensions(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setMachineWeight((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setMachinePrice((int) xssfSheet.getRow(counter++).getCell(1).getNumericCellValue()); entity.setDescription(xssfSheet.getRow(counter++).getCell(1).getStringCellValue()); entity.setMainPhoto(xssfSheet.getRow(counter).getCell(1).getStringCellValue()); ArrayList<ThreeRollMillPhoto> photoList = new ArrayList<>(); for (int i = 0; i < 5; i++) { if (!(xssfSheet.getRow(counter).getCell(1).getStringCellValue()).equals("")) { ThreeRollMillPhoto photo = new ThreeRollMillPhoto(); photo.setImageName(xssfSheet.getRow(counter).getCell(1).getStringCellValue()); photo.setThreeRollMill(entity); photoList.add(photo);//from w w w . j a va2 s. com } counter++; } ArrayList<ThreeRollMillVideo> videoList = new ArrayList<>(); for (int i = 0; i < 5; i++) { if (!(xssfSheet.getRow(counter).getCell(1).getStringCellValue()).equals("")) { ThreeRollMillVideo video = new ThreeRollMillVideo(); video.setVideoUrl(xssfSheet.getRow(counter).getCell(1).getStringCellValue()); video.setThreeRollMill(entity); videoList.add(video); } counter++; } entity.setPhotoList(photoList); entity.setVideoList(videoList); } catch (Exception e) { e.printStackTrace(); } return entity; }
From source file:mil.tatrc.physiology.datamodel.dataset.DataSetReader.java
License:Apache License
protected static List<SEPatient> readPatients(XSSFSheet xlSheet) { String property, value, unit; List<SEPatient> patients = new ArrayList<SEPatient>(); try {// ww w. j ava 2s .c o m 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 patients we have for (int i = 1; i < cells; i++) patients.add(new SEPatient()); } property = row.getCell(0).getStringCellValue(); if (property == null || property.isEmpty()) continue; Log.info("Processing Patient 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); } if (value.equals("INF")) value = "Infinity"; if (!setProperty(patients.get(c - 1), property, value, unit)) { Log.error("Error pulling" + property + " from " + cellValue); break; } } } } catch (Exception ex) { Log.error("Error reading XLS", ex); return null; } return patients; }
From source file:mil.tatrc.physiology.datamodel.dataset.DataSetReader.java
License:Apache License
protected static Map<String, SESubstance> readSubstances(XSSFSheet xlSheet) { EnumAnatomy currCmpt = null;//from www. ja va2 s .co m String property, value, unit; SESubstance substance = null; SESubstanceAnatomyEffect afx = null; List<SESubstance> substances = new ArrayList<SESubstance>(); Set<Integer> skipColumns = new HashSet<Integer>(); 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) { for (int c = 1; c < cells; c++) { property = row.getCell(c).getStringCellValue().trim(); if (property.equals("Reference Value") || property.equals("Reference Source") || property.equals("Notes/Page")) skipColumns.add(c); } } property = row.getCell(0).getStringCellValue().trim(); if (property == null || property.isEmpty()) continue; Log.info("Processing Substance Field : " + property); if (property.indexOf("Compartment Effects") > -1) { if (property.indexOf("Myocardium") > -1) currCmpt = EnumAnatomy.MYOCARDIUM; else if (property.indexOf("Fat") > -1) currCmpt = EnumAnatomy.FAT; else if (property.indexOf("Kidneys") > -1) currCmpt = EnumAnatomy.KIDNEYS; else if (property.indexOf("Brain") > -1) currCmpt = EnumAnatomy.BRAIN; else if (property.indexOf("Muscle") > -1) currCmpt = EnumAnatomy.MUSCLE; else if (property.indexOf("Skin") > -1) currCmpt = EnumAnatomy.SKIN; else if (property.indexOf("Bone") > -1) currCmpt = EnumAnatomy.BONE; else if (property.indexOf("Gut") > -1) currCmpt = EnumAnatomy.GUT; else if (property.indexOf("Splanchnic") > -1) currCmpt = EnumAnatomy.SPLANCHNIC; else if (property.indexOf("Spleen") > -1) currCmpt = EnumAnatomy.SPLEEN; else if (property.indexOf("Large Intestine") > -1) currCmpt = EnumAnatomy.LARGE_INTESTINE; else if (property.indexOf("Small Intestine") > -1) currCmpt = EnumAnatomy.SMALL_INTESTINE; else if (property.indexOf("Liver") > -1) currCmpt = EnumAnatomy.LIVER; else if (property.indexOf("Right Lung") > -1) currCmpt = EnumAnatomy.RIGHT_LUNG; else if (property.indexOf("Left Lung") > -1) currCmpt = EnumAnatomy.LEFT_LUNG; else { Log.error("Unsupported Anatomy Compartment : " + property); break; } } int s = -1; for (int c = 1; c < cells; c++) { if (skipColumns.contains(c)) continue; s++; 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; case XSSFCell.CELL_TYPE_FORMULA: switch (evaluator.evaluateFormulaCell(cell)) { case XSSFCell.CELL_TYPE_NUMERIC: cellValue = Double.toString(cell.getNumericCellValue()); break; case XSSFCell.CELL_TYPE_STRING: cellValue = cell.getStringCellValue(); break; } } if (cellValue == null) continue; cellValue = cellValue.trim(); if (cellValue.isEmpty()) continue; if (property.equals("Name")) { substance = new SESubstance(); substances.add(substance); } int split = cellValue.indexOf(" "); // Pull The Value if (split == -1) { value = cellValue; unit = ""; } else { value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); } if (value.equals("INF")) value = "Infinity"; substance = substances.get(c - (3 * s) - 1); if (currCmpt == null) afx = null; else afx = substance.getAnatomyEffect(currCmpt); if (!setProperty(substance, afx, property, value, unit)) { Log.error("Error pulling" + property + " from " + cellValue); break; } } } } catch (Exception ex) { Log.error("Error reading XLS", ex); return null; } Map<String, SESubstance> map = new HashMap<String, SESubstance>(); for (SESubstance sub : substances) map.put(sub.getName(), sub); return map; }
From source file:mil.tatrc.physiology.datamodel.dataset.DataSetReader.java
License:Apache License
protected static List<SESubstanceCompound> readCompounds(XSSFSheet xlSheet, Map<String, SESubstance> substances) { String property, value, unit; SESubstance s;//from w w w .ja v a 2s .com SESubstanceCompound compound = null; SESubstanceCompoundComponent component = null; List<SESubstanceCompound> compounds = new ArrayList<SESubstanceCompound>(); 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 patients we have for (int i = 1; i < cells; i++) compounds.add(new SESubstanceCompound()); } property = row.getCell(0).getStringCellValue(); if (property == null || property.isEmpty()) continue; Log.info("Processing Patient Field : " + property); if (property.equals("Data Type")) continue;// Only one type at this point 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); } compound = compounds.get(c - 1); if (property.equals("Compound Name")) { compound.setName(value); continue; } if (property.equals("Component Name")) { s = substances.get(value); component = compound.getComponent(s); continue; } if (!setProperty(component, property, value, unit)) { Log.error("Error setting property"); break; } } } } catch (Exception ex) { Log.error("Error reading XLS", ex); return null; } return compounds; }
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 w w w .ja v a2s . 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;//from ww w . jav a 2s. c om 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.datamodel.dataset.DataSetReader.java
License:Apache License
protected static Map<String, PhysiologyEngineStabilization> readStabilization(XSSFSheet xlSheet) { int split;/*from w w w . j a v a 2 s . c om*/ // Fields are expected data we must have Set<String> fields = new HashSet<String>(); fields.add("Criteria"); fields.add("ConvergenceTime"); fields.add("MinimumReactionTime"); fields.add("MinimumReactionTime"); fields.add("MaxAllowedStabilizationTime"); fields.add("TimedStabilizationLength"); String property, value, unit, cellValue; PhysiologyEngineTimedStabilization timed = new PhysiologyEngineTimedStabilization(); PhysiologyEngineDynamicStabilization dynamic = new PhysiologyEngineDynamicStabilization(); Map<String, PhysiologyEngineStabilization> map = new HashMap<String, PhysiologyEngineStabilization>(); map.put("TimedStabilization", timed); map.put("DynamicStabilization", dynamic); SEScalarTime time = null; PhysiologyEngineDynamicStabilization.Criteria criteria = null; try { int rows = xlSheet.getPhysicalNumberOfRows(); for (int r = 0; r < rows; r++) { XSSFRow row = xlSheet.getRow(r); if (row == null) continue; property = row.getCell(0).getStringCellValue(); if (property == null || property.isEmpty()) continue; if (!fields.contains(property)) { if (property.equals("Resting")) { criteria = dynamic.getRestingStabilizationCriteria(); time = timed.getRestingStabilizationTime(); } else if (property.equals("Feedback")) { criteria = dynamic.getFeedbackStabilizationCriteria(); time = timed.getFeedbackStabilizationTime(); } else { criteria = dynamic.createCondition(property); time = timed.createCondition(property); } continue; } else if (property.equals("Criteria")) { criteria.createProperty(row.getCell(1).getNumericCellValue(), row.getCell(2).getStringCellValue()); } else if (property.equals("ConvergenceTime")) { cellValue = row.getCell(1).getStringCellValue(); split = cellValue.indexOf(" "); value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); criteria.convergenceTime.setValue(Double.parseDouble(value), unit); } else if (property.equals("MinimumReactionTime")) { cellValue = row.getCell(1).getStringCellValue(); split = cellValue.indexOf(" "); value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); criteria.minimumReactionTime.setValue(Double.parseDouble(value), unit); } else if (property.equals("MaxAllowedStabilizationTime")) { cellValue = row.getCell(1).getStringCellValue(); split = cellValue.indexOf(" "); value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); criteria.maximumAllowedStabilizationTime.setValue(Double.parseDouble(value), unit); } else if (property.equals("TimedStabilizationLength")) { cellValue = row.getCell(1).getStringCellValue(); split = cellValue.indexOf(" "); value = cellValue.substring(0, split); unit = cellValue.substring(split + 1); time.setValue(Double.parseDouble(value), unit); } } } catch (Exception ex) { Log.error("Error reading XLS", ex); return null; } return map; }