I am using poi-3.2-FINAL-20081019.jar. I have tried to upload both the jar and excel sheet here again and again but I dont know if the files hav been uploaded, as I myself cant see the uploaded file. If you cant see the uploaded files give me your email address and I 'll send those files to u through my personal email. Cheers
Pierre Lavignotte wrote: > > Ok.... > So please tell what version of POI you use and copy your stacktrace here. > > Pierre > > Cordialement, > Pierre Lavignotte > Ingénieur Conception & Développement > http://pierre.lavignotte.googlepages.com > > > On Wed, Jan 28, 2009 at 4:16 PM, rfconsultant > <[email protected] >> wrote: > >> >> Noooo! The contents of workbook0 row 3 cell 3 are not null but >> AWBE1NI-AWBE1NO and line 22 of java code is >> cell = row.getCell((short)3); >> . >> >> >> >> Pierre Lavignotte wrote: >> > >> > Hi, >> > >> > Not sure where you line 22 is, but maybe your sheet 0 or row 3 is null. >> > You should test it before use. >> > >> > Pierre >> > >> > Cordialement, >> > Pierre Lavignotte >> > Ingénieur Conception & Développement >> > http://pierre.lavignotte.googlepages.com >> > >> > >> > On Wed, Jan 28, 2009 at 3:03 PM, rfconsultant >> > <[email protected] >> >> wrote: >> > >> >> >> >> I have written a simple code to read certain cell value in excel >> sheet. >> >> The >> >> program works absoulutely fine with some workbooks but some workbooks >> r >> >> givin >> >> Exception in thread "main" java.lang.NullPointerException >> >> >> >> at Excel_test.main(Excel_test.java:22) >> >> >> >> . I dont know whats worong as the data format and location of the >> excel >> >> is >> >> unchanged.(Note: The files with error have macro in that but my >> program >> >> has >> >> nothing to do with macro I am only concerned with the content) java >> code >> >> for >> >> your info is given below >> >> >> >> >> >> >> >> import org.apache.poi.hssf.usermodel.*; >> >> >> >> import java.io.*; >> >> >> >> public class Excel_test { >> >> >> >> /** >> >> * @param args >> >> */ >> >> public static void main(String[] args) { >> >> // TODO Auto-generated method stub >> >> HSSFRow row; >> >> HSSFCell cell; >> >> String s2; >> >> try{ >> >> >> >> InputStream myxls= new >> >> >> >> >> FileInputStream("C:\\Ericsson\\E4E\\workspace\\Route_updater\\tkroute_oss-rc_090123_4pm.xls"); >> >> HSSFWorkbook wb = new HSSFWorkbook(myxls); >> >> HSSFSheet sheet = wb.getSheetAt(0); >> >> >> >> row = sheet.getRow(3); >> >> cell = row.getCell((short)3); >> >> if (cell!=null){ >> >> >> >> s2=cell.getStringCellValue(); >> >> System.out.println(s2); >> >> } >> >> } >> >> >> >> catch(FileNotFoundException ex) >> >> { >> >> System.out.println("FileNotFoundException : " + >> >> ex); >> >> } >> >> catch(IOException ioe) >> >> { >> >> System.out.println("IOException : " + ioe); >> >> } >> >> >> >> >> >> >> >> } >> >> } >> >> >> >> >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/problem-in-reading-simple-excel-sheet-tp21706313p21706313.html >> >> Sent from the POI - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [email protected] >> >> For additional commands, e-mail: [email protected] >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/problem-in-reading-simple-excel-sheet-tp21706313p21707719.html >> Sent from the POI - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > http://www.nabble.com/file/p21709166/tkroute_oss-rc_090123_4pm.xls tkroute_oss-rc_090123_4pm.xls http://www.nabble.com/file/p21709166/poi-3.2-FINAL-20081019.jar poi-3.2-FINAL-20081019.jar http://www.nabble.com/file/p21709166/tkroute_oss-rc_090123_4pm.xls tkroute_oss-rc_090123_4pm.xls -- View this message in context: http://www.nabble.com/problem-in-reading-simple-excel-sheet-tp21706313p21709166.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
