private String getName(XSSFRow row) { return row.getCell(1).toString().trim(); }
private String getComment(XSSFRow row) { return row.getCell(3).toString().trim(); }
private String getComment(XSSFRow row) { return row.getCell(3).toString().trim(); }
private String getName(XSSFRow row) { return row.getCell(1).toString().trim(); }
int[] cellNums = {indexes.name, indexes.status, ... ,indexes.rpcBr}; String[] cellVals = new String[cellNums.length]; XSSFRow r = sheet.getRow(row); for (int i=0; i<cellNums; i++) { XSSFCell c = r.getCell(cellNums[i]); cellVals[i] = c == null ? null : c.toString(); } RPCManager rpc = new RPCManager( cellVals[0], cellVals[1], ... cellVals[13], row);
for(i=0;i<numrow;i++){ String[] newArray=new String[numcol]; for (j=0;j<numcol;j++ ){ if(xlsh.getRow(i).getCell(j)!=null){ XSSFCell cellval=xlsh.getRow(i).getCell(j); cellval.setCellType(Cell.CELL_TYPE_STRING); newArray[j] = cellval.toString(); } else{ newArray[j] = ""; } } xldata[i][0] = newArray; } return xldata;
XSSFRow row; XSSFCell cell; Iterator rows = sheet.rowIterator(); while (rows.hasNext()){ row=(XSSFRow) rows.next(); Iterator cells = row.cellIterator(); while (cells.hasNext()) { cell=(XSSFCell) cells.next(); cIndex=cell.getColumnIndex(); data += cell.toString() + ", "; } dataList.add(data); }
private boolean hasComment(XSSFRow row) { return null != row.getCell(3) && !row.getCell(3).toString().isEmpty(); }
private boolean hasComment(XSSFRow row) { return null != row.getCell(3) && !row.getCell(3).toString().isEmpty(); }
dirName = dirName + "\\" + cell.toString();
String CellData=cell.toString(); if(searchText.equals(CellData))
public static void test(XSSFSheet sheet){ XSSFRow Row = null; XSSFCell Cell = null; int LastRowNum = sheet.getLastRowNum(); for(int RowNum= 0;RowNum<LastRowNum-1;RowNum++){ Row=sheet.getRow(RowNum); for(int CellNum = 0; CellNum<Row.getLastCellNum();CellNum++){ Cell = Row.getCell(CellNum); String TextInCell=Cell.toString(); if(TextInCell.contains("JUNI")){ sheet.shiftRows(RowNum+1, LastRowNum, -1); LastRowNum--; RowNum--; break; } } } }
public static Option<String[]> getHeadersExcel(File file) { try { FileInputStream fis = new FileInputStream(file); XSSFWorkbook wb = new XSSFWorkbook(fis); XSSFSheet ws = wb.getSheetAt(0); // read the first sheet int totalRows = ws.getLastRowNum(); if (totalRows == 0) { return Option.failure("No lines found in file " + file.getName()); } XSSFRow row = ws.getRow(0); String[] headers = new String[row.getLastCellNum()]; for (int index = 0; index < row.getLastCellNum(); index++) { XSSFCell cell = row.getCell(index); assert cell != null : "Got null cell at index " + index; headers[index] = cell.toString(); } return Option.success(headers); } catch (IOException e) { e.printStackTrace(); return Option.failure("Encountered IOException."); } }
if (sheet.getRow(x).getCell(j).toString().trim() .equals("")) { isRowEmpty = true;
public static String getFromExcel(XSSFWorkbook wb, String... format) { StringBuilder builder = getStart(); int line = Configuration.CONFIG.shouldSkipFirstLine ? 1 : 0; XSSFSheet ws = wb.getSheetAt(0); // read the first sheet int totalColumns = ws.getRow(0).getLastCellNum(); int totalRows = ws.getLastRowNum(); Map<String, String> rowMap = map(); for (; line <= totalRows; line++) { // we want <= because the index returned from ws.getLastRowNum() is valid XSSFRow row = ws.getRow(line); for (int column = 0; column < totalColumns; column++){ XSSFCell cell = row.getCell(column); if (cell == null) { // cells are null if there's no data in them; this is fine. continue; } String value = cell.toString(); if (format.length > column) { rowMap.put(format[column], value); } else { System.err.println("format wasn't long enough for column. Column length = " + totalColumns + ", format was " + format.length); } } addRecord(builder, line, rowMap); rowMap.clear(); } return writeEnd(builder); }
break; case _NONE: cellValue = cell.toString(); break; default: