Using POI in converting Exel format to textfile format
843836Dec 15 2004 — edited Sep 25 2006Hi Guys!!!
Im creating a web application using jsp and servlet..I decided to use apache POI in converting the excel to textfile..Some expert recommended to use this method since im dealing with java technology..
Here is the example code taken to the site: A quick guide to use HSSF/POI,
(indicated below)
My problem is How will i use this code and modify it..The action will be to write the data from EXCEL to TEXTFILE format..If you have an idea or another sample code please send me..Need your Help!!thankyou
Reading and Rewriting Workbooks
POIFSFileSystem fs =
new POIFSFileSystem(new FileInputStream("workbook.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(2);
HSSFCell cell = row.getCell((short)3);
if (cell == null)
cell = row.createCell((short)3);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("a test");
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();