im trying take first sheet , put linkedlist, doesnt take first sheet, starts number one, , counter started zero. have been trying other kind of things, sheet 0 full.
public void leer_archivo(string ruta)throws ioexception{ fileinputstream file = new fileinputstream(new file (ruta)); xssfworkbook workbook = new xssfworkbook(file); (int = 0; < 5; i++){ system.out.println(i); xssfsheet sheet = workbook.getsheetat(i); iterator<row> rowiterator = sheet.iterator(); row row; while (rowiterator.hasnext()){ row = rowiterator.next(); iterator<cell> celliterator = row.celliterator(); cell celda; while (celliterator.hasnext()){ celda = celliterator.next(); switch(celda.getcelltype()) { case cell.cell_type_numeric: if( hssfdateutil.iscelldateformatted(celda) ){ system.out.println(celda.getdatecellvalue()); }else{ // system.out.println(celda.getnumericcellvalue()); //cuando cae aqui repite los valores de la celda } valorcelda = (int) celda.getnumericcellvalue(); agregar_valor( valorcelda, i); break; case cell.cell_type_string: nombrecelda = celda.getstringcellvalue(); agregar_equipo(nombrecelda, i); system.out.println(i + "hola"); break; } } } workbook.close(); } }
Comments
Post a Comment