Apache POI - CREATE_NULL_AS_BLANK - how?
When I was testing my program, I noticed a fault in it.
When it is reading in an excel file, it doesn't take the empty cells with it.
So all my output is moved up, while that is realy Not allowed.
The same problem this guy/girl has:
java - How to get an Excel Blank Cell Value in Apache POI? - Stack Overflow
Now it also show the answer.
But I have no clue about where to put that in my code?
Since his/her code only needs to print it.
I was thinking myself in that while (rows1.hasNext()) { loop.
But I am nt too sure now.
I also tried several things, but it all doesn't work.
Re: Apache POI - CREATE_NULL_AS_BLANK - how?
I found the answer.
Seems like I typed in something wrong, and now it works. :)
Re: Apache POI - CREATE_NULL_AS_BLANK - how?
Hmm, okey maybe still I hve a question about it.
I solved it with:
Code :
// Make sure empty cells are not skipped.
row.getCell(blank, Row.RETURN_NULL_AND_BLANK);
// Return "null" when a cell is empty.
String BlankOrNot = "" + row.getCell(blank, Row.RETURN_NULL_AND_BLANK);
I must say it works when there 1 empty cell.
But when there are 2 empty cells next to each other he only returns one....
Re: Apache POI - CREATE_NULL_AS_BLANK - how?
I there maybe a way too get like:
Cell1 Cell2 Cell3 Cell4
Human <empty cell> <empty cell> Mouse
To get back:
Human = 1 (or 0)
Mouse = 4 (or 3)
I have used cells.hasNext() to grab the next cell.
Can I also give it to return such a number with it?