lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spinergywmy <spinergy...@gmail.com>
Subject Re: Index Excel File
Date Thu, 14 Dec 2006 03:10:30 GMT

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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message