poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc <wdkm...@wilson.dk>
Subject Re: Problem writing xls
Date Tue, 05 Apr 2005 13:59:29 GMT

Sorry the late reply.

This is the code from where it goes wrong:

I take a sheet and makes a iterator, to go over the rows. Moves the 
iterator's maker to position 4, because thats where me data starts. Then 
I check's if the cell in the current row is blank. If it is not. I go 
thow the rows making them into beans.
And at last I return the beans in a ArrayList.

But as I said in me first mail. First time I call it on a new sheet it 
counts 1 short. See the output in the bottom.

private Collection getAlias(HSSFSheet sheet) throws NoRowsExcistException {
         ConstansForAliasPOI constant = ConstansForAliasPOI.getInstance();
         ArrayList _alias = new ArrayList();
         int start = constant.getSTRATOFALIAS();
         Iterator rows = sheet.rowIterator();
         HSSFRow curretrow =(HSSFRow) rows.next();
         for(int n=0;n<start-1;n++)curretrow = (HSSFRow)rows.next();

         MailAliasDTO currentDTO;


                 curretrow = (HSSFRow) rows.next();
                 currentDTO = new MailAliasDTO(); 


             throw new NoRowsExcistException();
         System.out.println("My alias list, from my xls, is this long: 
"+_alias.size()+" when I call getAlias()");
         return _alias;

Output first run:
My alias list, from my xls, is this long: 3 when I call getAlias()

But there is 4 lines in me XLS.
If I then make a change in the XLS or add's one. Lets say I add one, so 
there is 5 lines in the XLS. And then runs the code, then I get:
My alias list, from my xls, is this long: 5 when I call getAlias()

To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

View raw message