0
我有一個Excel表格,包含6行和31列,我想將它導入到我的jsf頁面。我成功地在控制檯中顯示它,但我找不到在我的jsf頁面中執行相同操作的方法。從jsf中導入excel中有組織的表格
這是代碼:
所有的public void showfile() throws FileNotFoundException,IOException{
FileInputStream fis= new FileInputStream("C:\\Users\\tahab_000\\Desktop\\Test.xls");
HSSFWorkbook wb=new HSSFWorkbook(fis);
HSSFSheet sheet=wb.getSheetAt(0);
FormulaEvaluator formulaEvaluator=wb.getCreationHelper().createFormulaEvaluator();
for(Row row: sheet){
for(Cell cell: row){
switch(formulaEvaluator.evaluateInCell(cell).getCellType()){
case Cell.CELL_TYPE_NUMERIC:
System.out.print(cell.getNumericCellValue()+"\t\t");
s1=s1+cell.getNumericCellValue();
break;
case Cell.CELL_TYPE_STRING:
System.out.print(cell.getStringCellValue()+"\t\t");
s1=s1+cell.getStringCellValue();
break;
}
}
System.out.println();
}
}