Hi,

   I did use jexcelapi to extract the contents out of excel file, however, I
couldn't get the content when I sysout. Below are the codes that I wrote,
perhaps you can point out where I have done wrong. Thanks.


   Workbook excelDoc = Workbook.getWorkbook(new FileInputStream(file));
                String content = "";
                
                for(int i = 0; i < excelDoc.getNumberOfSheets(); i++)
                {
                        Sheet sheet = excelDoc.getSheet(i);
                        
                        Cell[] row = null;
                        
                        for(int j = 0; j < sheet.getRows(); j++)
                        {
                                row = sheet.getRow(i);
                                
                                System.err.println("row is ::: " +row.length);
                                
                                if(row.length > 0)
                                {
                                        content = row[i].getContents();
                                        System.err.println("content inside loop 
is ::: " +content);
                                }
                        }
                }
                
                System.err.println("content is ::: " +content);
                
                doc.add(new Field(DsConstant.idxFileContent, content, 
Field.Store.YES,
Field.Index.TOKENIZED));
                doc.add(new Field(DsConstant.idxFileName, file.getName(), 
Field.Store.YES,
Field.Index.UN_TOKENIZED));
                doc.add(new Field(DsConstant.idxPath, file.getPath(), 
Field.Store.YES,
Field.Index.UN_TOKENIZED));
                
                excelDoc.close();

regards,
Wooi Meng
-- 
View this message in context: 
http://www.nabble.com/Index-Excel-File-tf2817920.html#a7866165
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to