I took a look at your Excel file adn run through my test POI program I think your problem is You may have formula that did not produce a value but as result of it your Sheet has 1-2 extra ending rows reserved. HOwever, those rows are not created by Excel since formula did not return values so the problem is PhysicalRowNumber returns more rows then actually in a sheet. You need to test your code for Row being NOT NULL and it will work ok or check youe formulas.
Igor --- "Anand,Anuj" <[EMAIL PROTECTED]> wrote: > > > Thanks for your help. An interesting aspect is that > if I get rid of the > formula in the first column of the spreadsheet ,it > is processed in > normal fashion and gives me more than 31 rows. > > I will try to incorporate that jar file and check > .We are using POI > version 1.8.x > > > > -----Original Message----- > From: Page, Michael A. > [mailto:[EMAIL PROTECTED] > Sent: Monday, August 29, 2005 4:58 PM > To: POI Users List > Subject: RE: Problem reading Excel File > > > > I didn't actually look at your code. I'm hoping > what I send you > will help > you fix yours. > > The attached java source file was able to read your > excel > spreadsheet. > I copied your excel file to the root of my c drive > and renamed > it HSSF.xls. > I use eclipse 3.1 as my development package and > have the > poi-2.5.1-final-20040804.jar added as an external > jar file. This jar > file resides in the > > same location of the java source file. I'm not sure > why my code > indicates > more rows and columns then your data would > indicate. Perhaps you > have some > hidden values floating around. > > Hope this helps. > > Mike > > -----Original Message----- > From: Anand,Anuj [mailto:[EMAIL PROTECTED] > Sent: Monday, August 29, 2005 3:25 PM > To: POI Users List > Subject: RE: Problem reading Excel File > > > Sorry for sending out the message > repeatedly....Attached is the > inline > code > > > import java.io.FileInputStream; > import java.io.FileOutputStream; > import java.io.IOException; > import java.io.InputStream; > import java.util.Calendar; > import java.util.Date; > > > import org.apache.poi.hssf.dev.HSSF; > import org.apache.poi.hssf.record.Record; > import org.apache.poi.hssf.usermodel.HSSFCell; > import org.apache.poi.hssf.usermodel.HSSFCellStyle; > import > org.apache.poi.hssf.usermodel.HSSFDataFormat; > import org.apache.poi.hssf.usermodel.HSSFDateUtil; > import org.apache.poi.hssf.usermodel.HSSFFont; > import org.apache.poi.hssf.usermodel.HSSFRow; > import org.apache.poi.hssf.usermodel.HSSFSheet; > import org.apache.poi.hssf.usermodel.HSSFWorkbook; > import org.apache.poi.hssf.util.Region; > import > org.apache.poi.poifs.filesystem.POIFSFileSystem; > > > > > > > /** > * File for HSSF testing/examples > * > * THIS IS NOT THE MAIN HSSF FILE!! This is a util > for testing > functionality. > * It does contain sample API usage that may be > educational to > regular > API users. > * > * @see #main > * @author Andrew Oliver (acoliver at apache dot > org) > */ > > > public class Test > { > private String filename = null; > > > // private POIFSFileSystem fs = > null; > private InputStream stream = null; > private Record[] records = null; > protected HSSFWorkbook hssfworkbook = null; > static char cell_flag = 'N'; > static char row_flag = 'N'; > > /** > * Constructor HSSF - creates an HSSFStream > from an > InputStream. > The HSSFStream > * reads in the records allowing modification. > * > * > * @param filename > * > * @exception IOException > * > */ > > > public Test(String filename) > throws IOException > { > this.filename = filename; > POIFSFileSystem fs = > new POIFSFileSystem(new > FileInputStream(filename)); > > > /* POIFSFileSystem fs1 = > new POIFSFileSystem(new > FileInputStream(filename)); > / p1 = new FileInputStream(*/ > > > hssfworkbook = new HSSFWorkbook(fs); > > > // records = > RecordFactory.createRecords(stream); > } > > > /** > * Constructor HSSF - given a filename this > outputs a sample > sheet > with just > * a set of rows/cells. > * > * > * @param filename > * @param write > * > * @exception IOException > * > */ > > > public Test(String filename, boolean write) > throws IOException > { > short rownum = 0; > FileOutputStream out = new > FileOutputStream(filename); > HSSFWorkbook wb = new > HSSFWorkbook(); > HSSFSheet s = wb.createSheet(); > HSSFRow r = null; > HSSFCell c = null; > HSSFCellStyle cs = > wb.createCellStyle(); > HSSFCellStyle cs2 = > wb.createCellStyle(); > HSSFCellStyle cs3 = > wb.createCellStyle(); > HSSFFont f = wb.createFont(); > HSSFFont f2 = wb.createFont(); > > > f.setFontHeightInPoints(( short ) 12); > f.setColor(( short ) 0xA); > f.setBoldweight(f.BOLDWEIGHT_BOLD); > === message truncated === ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
