2012-04-07 22 views
7

Sto provando a leggere un file xls utilizzando SXSSF. Ho letto su SXSSF, ma non capisco esattamente come usarlo. Quindi sto incontrando alcuni problemi.Come utilizzare POI SXSSF per leggere un foglio di calcolo di grandi dimensioni

Qualcuno può aiutarmi con il codice java per la lettura di file xls di grandi dimensioni (circa 100.000 righe e 7-8 fogli).

(Edit dai commenti)

Ecco che cosa ho provato:

Workbook workBook = new SXSSFWorkbook(200); 
workBook = WorkbookFactory.create(inputStream); 
Sheet sheet = workBook.getSheetAt(0); 
int totalRows = sheet.getPhysicalNumberOfRows(); 

for (int i=0; i<totalRows; i++) { 
    Row row = sheet.getRow(i); 
    int totalCols = row.getPhysicalNumberOfCells(); 
    for(int j=0; j<totalCols; j++) { 
     Cell cell = row.getCell(j); 
    } 
} 
+1

[Che cosa hai provato?] (Http://mattgemmell.com/2008/12/08/what-have-you-tried/) [ Questo] (http://stackoverflow.com/questions/4752456/memory-efficient-java-library-to-read-excel-files) o [That] (http://stackoverflow.com/questions/4085517/which- per esempio is-the-best-api-read-large-sized-excel-files-in-java)? – nobeh

+0

ho provato qualcosa di simile ..... – abhi

+0

Workbook workBook = new SXSSFWorkbook (200); workBook = WorkbookFactory.create (inputStream); Foglio: workBook.getSheetAt (0); int totalRows = sheet.getPhysicalNumberOfRows(); per (int i = 0; i abhi

risposta

Problemi correlati