Try to load information on JSP from Excel file (*.xlsx) use Apache POI 3.15.
View information in excel
num solution
1 First
2 Second
3 Third
try to use code
try {
InputStream ExcelFileToRead = new FileInputStream("C:\\server\\to_db.xlsx");
XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead);
XSSFWorkbook test = new XSSFWorkbook();
XSSFSheet sheet = wb.getSheetAt(0);
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();
if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING) {
out.print(cell.getStringCellValue() + " ");
} else if (cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) {
out.print(cell.getNumericCellValue() + " ");
} else {
//U Can Handel Boolean, Formula, Errors
}
}
out.println("Succefully!!!");
}
}
catch (Exception e) {
out.println( "exception: "+e);
}
Getting a strange result:
absent error and absent information on JSP....
Problem problem is reproduced in all browsers. If I try open C:\server\to_db.xlsx OS Windows responce "File is busy". What could be the problem and how to solve it?