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;

        if(!(curretrow.getCell((short)0)==null)){
            while(rows.hasNext()){

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



currentDTO.setOwner(curretrow.getCell((short)0).getStringCellValue());
currentDTO.setAlias(curretrow.getCell((short )1).getStringCellValue());


currentDTO.setReciver(curretrow.getCell((short)2).getStringCellValue());
                _alias.add(currentDTO);

}
}else{
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: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/



Reply via email to