× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



After calling getCell() make sure you check to see if the cell object is *NULL. That'll mean that there's no cell in that particular column of that particular row (it shows up as an empty cell on the screen in Excel, but it's not actually stored in the file, because it'd waste disk space storing empty cells).

If you get a *NULL, it means that there'snothing there. You can add a new cell using HSSFRow_CreateCell(), or my hssf_text(), hssf_num(), etc shortcuts if you want to add a cell at that position.

If you're only trying to read existing cells, it should be safe to skip anything that's *NULL.

If you try to refer to the cell object after it returns *NULL, you'll end up crashing the JVM.



DLee@xxxxxxxx wrote:
Morning all;

poi excel problem, evidentally I'm not understanding whats going on here.
I'm trying to loop thru the cells on row zero to copy those cells to another sheet.

I used getlastcellnum to determine the last cell (lcellno) = 47 as a short.

rowcount = 0; x = 0; defined as int
row = HSSFSheet_getRow(sheet:rowcount);
lcellno = HSSFRow_getLastCellNum(row);

dow x <= lcellno; cell = HSSFRow_GetCell(row: x ); resolves to 0 for cell 9
type = HSSFCell_getCellType(cell); resolves to 0
but when x = 9, cell value is 0, and blows up on th getStringCellValue.
my confusion is why cell value is zero, when row is 0, and x is 9. Could it be null, if so how do I tell.

when type = CELL_TYPE_BLANK; StrVal += String_getBytes(HSSFCell_getStringCellValue(cell)); hssf_text ( rowo : y :StrVal: Text);
Also, everytime it blows up, I have to signoff and sign back on to do a retest. I don't understand that.

Appreciate any help


Darrell Lee
Information Technology
Extension 7127


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.