// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;

import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;

public class ReadPOI {
   public static void main(String[] args) throws Exception {
      POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("C:\\jtest.xls"));
      HSSFWorkbook wb = new HSSFWorkbook(fs);
      HSSFSheet sheet = wb.getSheetAt(0);
      int rownum = 1;
      for (;;) {
         HSSFRow row = sheet.getRow(rownum);
         if(row==null) break;
         HSSFCell ivcell = row.getCell((short)0);
         int iv = (int)ivcell.getNumericCellValue();
         HSSFCell svcell = row.getCell((short)1);
         String sv = svcell.getStringCellValue();
         System.out.println(iv + " " + sv);
         rownum++;
      }
   }
}
