List of usage examples for org.apache.poi.hssf.usermodel HSSFRow getCell
@Override public HSSFCell getCell(int cellnum)
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void compnaiesFromExcel2(String xlsPath) { InputStream inputStream = null; try {//from w w w .ja v a 2 s. c om inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); boolean check = false; while (rows.hasNext()) { check = false; HSSFRow row = (HSSFRow) rows.next(); // if (row.getRowNum() >= end_row) { // break; // } if (row.getRowNum() <= start_row) { continue; } Companies companies = new Companies(); // System.out.println("Row No.: " + row.getRowNum()); String companyName = row.getCell(2).getRichStringCellValue().getString(); if (!companyName.isEmpty()) { Companies companiesTEMP = databaseHelper.companiesDao.getFirst("company_fa", companyName); if (companiesTEMP == null) { check = true; companies.setCompany_fa(companyName); companies.setActive(true); } } else { continue; } try { String companyNameEn = row.getCell(9).getRichStringCellValue().getString(); if (!companyNameEn.isEmpty()) { // Companies companiesTEMP = databaseHelper.companiesDao.getFirst("company_en", companyNameEn); // if (companiesTEMP == null) { // companies.setCompany_en(companyNameEn); // } } } catch (Exception e) { } if (check) { // companieses.add(companies); Manage mm = databaseHelper.manageDao.getFirst("key", "company_folder_count"); int jj = Integer.parseInt(mm.getValue()); companies.setFolder_name("C" + jj); databaseHelper.companiesDao.createOrUpdate(companies); ++jj; mm.setValue(jj + ""); databaseHelper.manageDao.createOrUpdate(mm); } } // databaseHelper.companiesDao.insertList(companieses); } catch (Exception e) { Logger.getLogger(POIExcelReader.class.getName()).log(Level.SEVERE, e.getMessage(), e); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void historyFromExcel2(String xlsPath) { InputStream inputStream = null; try {/*from ww w . ja va 2 s .co m*/ inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); boolean check = false; List<History> historys = new ArrayList<>(); while (rows.hasNext()) { check = false; HSSFRow row = (HSSFRow) rows.next(); History historyH = null; String history = ""; // System.out.println("Row No.: " + row.getRowNum()); try { history = row.getCell(6).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(7).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(8).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(9).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(10).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(11).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(12).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(13).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } } databaseHelper.historyDao.insertList(historys); } catch (Exception e) { e.printStackTrace(); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void worksFromExcel2(String xlsPath) { InputStream inputStream = null; try {// ww w . ja v a 2 s .c o m inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; List<CarHistory> historys = new ArrayList<>(); try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); boolean check = false; while (rows.hasNext()) { check = false; HSSFRow row = (HSSFRow) rows.next(); // if (row.getRowNum() >= end_row) { // break; // } if (row.getRowNum() <= start_row) { continue; } CarHistory carHistory = new CarHistory(); // System.out.println("Row No.: " + row.getRowNum()); String row_value = row.getCell(2).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { Companies companiesTEMP = databaseHelper.companiesDao.getFirst("company_fa", row_value); carHistory.setCompanies(companiesTEMP); } row_value = row.getCell(5).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { carHistory.setPellak(row_value); } try { row_value = row.getCell(6).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardExpirationDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = row.getCell(7).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardIssuedDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = row.getCell(8).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardIssuedDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = row.getCell(9).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardIssuedDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = row.getCell(10).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardIssuedDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = row.getCell(11).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardIssuedDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = row.getCell(12).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { row_value = row_value.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", row_value); carHistory.setCardDeliveryDateId(HistoryTEMP); } } catch (Exception e) { } try { row_value = ((long) row.getCell(1).getNumericCellValue()) + ""; if (!row_value.isEmpty()) { Cars cr1 = databaseHelper.carDao.getFirst("card_id", row_value); carHistory.setCar_id(cr1); } } catch (Exception e) { } try { row_value = row.getCell(1).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { Cars cr1 = databaseHelper.carDao.getFirst("card_id", row_value); carHistory.setCar_id(cr1); } } catch (Exception e) { } historys.add(carHistory); // databaseHelper.manageDao.createOrUpdate(mm); } databaseHelper.carsHistoryDao.insertList(historys); } catch (Exception e) { Logger.getLogger(POIExcelReader.class.getName()).log(Level.SEVERE, e.getMessage(), e); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void historyFromExcel3(String xlsPath) { InputStream inputStream = null; try {//from w w w. java 2 s .com inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); boolean check; List<History> historys = new ArrayList<>(); while (rows.hasNext()) { check = false; HSSFRow row = (HSSFRow) rows.next(); History historyH = null; String history = ""; // System.out.println("Row No.: " + row.getRowNum()); try { history = row.getCell(7).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(10).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } check = false; historyH = null; history = ""; try { history = row.getCell(11).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } } databaseHelper.historyDao.insertList(historys); } catch (Exception e) { e.printStackTrace(); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void displayFromExcel3(String xlsPath) { InputStream inputStream = null; try {/*from www .j a va2 s .c o m*/ inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; int dd = 0; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); List<Individuals> individualses = new ArrayList<>(); // Manage manage = databaseHelper.manageDao.getFirst("key", "card_id_count"); // long card_sequential = Long.parseLong(manage.getValue()); while (rows.hasNext()) { HSSFRow row = (HSSFRow) rows.next(); // if (row.getRowNum() >= end_row) { // break; // } if (row.getRowNum() <= start_row) { continue; } dd = row.getRowNum(); // if (row.getRowNum() == 0 // || row.getRowNum() < 195 || row.getRowNum() > 250 // ) { // continue; // } Individuals individuals = null; // display row number in the console. // System.out.println("Row No.: " + row.getRowNum()); // once get a row its time to iterate through cells. String meli = ""; { try { meli = (((long) row.getCell(6).getNumericCellValue()) + ""); } catch (Exception e) { } try { meli = (row.getCell(6).getRichStringCellValue().getString()); } catch (Exception e) { } // System.out.println("meli = " + meli); individuals = databaseHelper.individualsDao.getFirst("national_id", meli); if (individuals == null) { individuals = new Individuals(); individuals.setNational_id(meli); // try { // individuals.setCard_id(((long) row.getCell(0).getNumericCellValue()) + ""); // } catch (Exception e) { // } // try { // individuals.setCard_id(row.getCell(0).getRichStringCellValue().getString()); // } catch (Exception e) { // } if (!row.getCell(1).getRichStringCellValue().getString().isEmpty()) { individuals.setFirst_name(row.getCell(1).getRichStringCellValue().getString()); } try { if (!row.getCell(2).getRichStringCellValue().getString().isEmpty()) { individuals .setFather_first_name(row.getCell(2).getRichStringCellValue().getString()); } } catch (Exception e) { } try { individuals.setId_number(((long) row.getCell(3).getNumericCellValue()) + ""); } catch (Exception e) { } try { individuals.setId_number(row.getCell(3).getRichStringCellValue().getString()); } catch (Exception e) { } try { if (!row.getCell(4).getRichStringCellValue().getString().isEmpty()) { individuals.setBirth_day(databaseHelper.historyDao.getFirst("date", row.getCell(4).getRichStringCellValue().getString().substring(2))); } } catch (Exception e) { } try { if (!row.getCell(5).getRichStringCellValue().getString().isEmpty()) { individuals.setBirth_state(row.getCell(5).getRichStringCellValue().getString()); } } catch (Exception e) { } try { individuals.setComments(" : " + ((long) row.getCell(0).getNumericCellValue()) + (individuals.getComments() != null ? "\n" + individuals.getComments() : "")); } catch (Exception e) { } try { individuals.setComments(" : " + row.getCell(0).getRichStringCellValue().getString() + (individuals.getComments() != null ? "\n" + individuals.getComments() : "")); } catch (Exception e) { } String split = FileSystems.getDefault().getSeparator(); individuals.setFilesPatch("data" + split + "1394" + split + dd / 50 + split + individuals.getNational_id() + split); // individuals.setCard_id(card_sequential + ""); // card_sequential++; individualses.add(individuals); } } // databaseHelper.individualsDao.createOrUpdate(individuals, dd); } } catch (Exception e) { e.printStackTrace(); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void displayFromExcel35(String xlsPath) { InputStream inputStream = null; try {//from www . ja va2s .c o m inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; int dd = 0; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); List<WorkHistory> whs = new ArrayList<>(); while (rows.hasNext()) { HSSFRow row = (HSSFRow) rows.next(); // if (row.getRowNum() >= end_row) { // break; // } if (row.getRowNum() <= start_row) { continue; } dd = row.getRowNum(); // if (row.getRowNum() == 0 // || row.getRowNum() < 195 || row.getRowNum() > 250 // ) { // continue; // } Individuals individuals = null; // display row number in the console. // System.out.println("Row No.: " + row.getRowNum()); // once get a row its time to iterate through cells. String meli = ""; { try { meli = (((long) row.getCell(6).getNumericCellValue()) + ""); } catch (Exception e) { } try { meli = (row.getCell(6).getRichStringCellValue().getString()); } catch (Exception e) { } // System.out.println("meli = " + meli); individuals = databaseHelper.individualsDao.getFirst("national_id", meli); } whs.add(works_add(row, individuals)); } databaseHelper.workHistoryDao.insertList(whs); } catch (Exception e) { e.printStackTrace(); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") private WorkHistory works_add(HSSFRow row, Individuals individuals) { WorkHistory wh = new WorkHistory(); wh.setIndividualsId(individuals);/*from w w w. j a v a 2 s . c o m*/ if (!row.getCell(7).getRichStringCellValue().getString().isEmpty()) { wh.setEmploymentDateId(databaseHelper.historyDao.getFirst("date", row.getCell(7).getRichStringCellValue().getString().substring(2))); } if (!row.getCell(8).getRichStringCellValue().getString().isEmpty()) { wh.setJobTitle(row.getCell(8).getRichStringCellValue().getString()); } String row_value = row.getCell(9).getRichStringCellValue().getString(); if (!row_value.isEmpty()) { Companies companiesTEMP = databaseHelper.companiesDao.getFirst("company_fa", row_value); wh.setCompanies(companiesTEMP); } if (!row.getCell(10).getRichStringCellValue().getString().isEmpty()) { wh.setCardIssuedDateId(databaseHelper.historyDao.getFirst("date", row.getCell(10).getRichStringCellValue().getString().substring(2))); } if (!row.getCell(11).getRichStringCellValue().getString().isEmpty()) { wh.setCardExpirationDateId(databaseHelper.historyDao.getFirst("date", row.getCell(11).getRichStringCellValue().getString().substring(2))); } if (!row.getCell(13).getRichStringCellValue().getString().isEmpty()) { if (row.getCell(13).getRichStringCellValue().getString().equals("?")) { wh.setCardDeliveryDate(wh.getCardExpirationDateId()); } } return wh; }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void history_replica(String xlsPath) { InputStream inputStream = null; try {/*from www . j av a2s .co m*/ inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); boolean check; List<History> historys = new ArrayList<>(); while (rows.hasNext()) { check = false; HSSFRow row = (HSSFRow) rows.next(); History historyH = null; String history = ""; // System.out.println("Row No.: " + row.getRowNum()); try { history = row.getCell(1).getRichStringCellValue().getString(); if (!history.isEmpty()) { history = history.substring(2); History HistoryTEMP = databaseHelper.historyDao.getFirst("date", history); if (HistoryTEMP == null) { check = true; historyH = new History(history.substring(0, history.indexOf("/")), history.substring(history.indexOf("/") + 1, history.lastIndexOf("/")), history.substring(history.lastIndexOf("/") + 1)); } } if (check) { historys.add(historyH); // databaseHelper.historyDao.createOrUpdate(historyH); } } catch (Exception e) { } } databaseHelper.historyDao.insertList(historys); } catch (Exception e) { e.printStackTrace(); } }
From source file:gatebass.utils.exel.POIExcelReader.java
@SuppressWarnings("unchecked") public void replica_FromExcel(String xlsPath) { InputStream inputStream = null; try {//www . j av a2 s. c om inputStream = new FileInputStream(xlsPath); } catch (FileNotFoundException e) { System.out.println("File not found in the specified path."); e.printStackTrace(); } POIFSFileSystem fileSystem = null; try { fileSystem = new POIFSFileSystem(inputStream); HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); HSSFSheet sheet = workBook.getSheetAt(0); Iterator rows = sheet.rowIterator(); List<IndividualReplica> individualReplicas = new ArrayList<>(); while (rows.hasNext()) { HSSFRow row = (HSSFRow) rows.next(); // if (row.getRowNum() >= end_row) { // break; // } if (row.getRowNum() <= start_row) { continue; } // if (row.getRowNum() == 0 // || row.getRowNum() < 195 || row.getRowNum() > 250 // ) { // continue; // } IndividualReplica individualReplica = new IndividualReplica(); // display row number in the console. // System.out.println("Row No.: " + row.getRowNum()); // once get a row its time to iterate through cells. String meli = ""; try { meli = (((long) row.getCell(3).getNumericCellValue()) + ""); } catch (Exception e) { } try { meli = (row.getCell(3).getRichStringCellValue().getString()); } catch (Exception e) { } Individuals individuals = databaseHelper.individualsDao.getFirst("card_id", meli); if (individuals != null) { // individualReplica.setIndividual_id(individuals); try { if (!row.getCell(1).getRichStringCellValue().getString().isEmpty()) { individualReplica.setHistory_id(databaseHelper.historyDao.getFirst("date", row.getCell(1).getRichStringCellValue().getString().substring(2))); } } catch (Exception e) { } try { individualReplica.setMablagh(((long) row.getCell(5).getNumericCellValue()) + ""); } catch (Exception e) { } try { individualReplica.setMablagh(row.getCell(5).getRichStringCellValue().getString()); } catch (Exception e) { } try { individualReplica.setDescription(((long) row.getCell(6).getNumericCellValue()) + ""); } catch (Exception e) { } try { individualReplica.setDescription(row.getCell(6).getRichStringCellValue().getString()); } catch (Exception e) { } individualReplicas.add(individualReplica); } else { System.out.println("replica ID : " + meli); } } databaseHelper.individualReplicaDao.insertList(individualReplicas); } catch (Exception e) { e.printStackTrace(); } }
From source file:gda.hrpd.data.ExcelWorkbook.java
License:Open Source License
/** * returns the specified cell from the specified row. * //ww w. j av a 2 s . c om * @param row * @param cellnum * @return HSSFCell */ public HSSFCell getCell(HSSFRow row, int cellnum) { return row.getCell(cellnum); }