Yes, that is quite possible. There is no pre-existing method to suport this
so you will have to write your own code to accomplish the task however.

I have not had to do something like this yet and have not tested the
following so please do not take it as read that everything will work
perfectly. Further, you do not say which file format you are targetting -
binary or OpenXML - so I am writing this code using the HSSF stream, the
binary one.

int colNumber = 2;  // Index for column C
int startRowNum = 2;    // Index for row number 3
int lastRowNum = 0;
File file = new File("... your file .....");
FileInoputStream fis = new FileInputStream(file);
HSSFWorkbook workbook = new HSSFWorkbook();
int numSheets = workbook.getNumberOfSheets();
for(int i = 0; i < numSheets; i++) {
    HSSFSheet sheet = workbook.getSheetAt(i);
    lastRowNum = sheet.getLastRowNum;
    for(int j = startRowNum; j < lastRowNum; j++) {
        HSSFCell cell = sheet.getRow(j).getCell(colNumber);
        switch(cell.getCellType()) {
           case HSSFCell.CELL_TYPE_STRING:
               System.out.println("Got a String type Cell.");
              
System.out.println(cell.getRichStringCellValue().getString());
           // And you cxan extend this to handle the other types of cells,
           // numeric, formula, error, boolean and blank. Check out the
           // Quick Guide and how to if you are at all unsure.
        }
    }
}



Otis HARRISON wrote:
> 
> Hi, I have a quick question about Poi and Hssf. I was wondering if you can
> specify a specific column and just grab that data. Then just keep going
> down that row until you reach the end. I am trying to go down, let say
> Column B row 11 and keep going down until i reach column B row 54109. I
> just want to put all those values into an array and just have to mess with
> the array. 
> 
> Thank alot for any help you can give. 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-poi-and-HSSF-tp24578519p24582583.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to