Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Apache POI - CREATE_NULL_AS_BLANK - how?

  1. #1
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default 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.

    xD
    Last edited by Purple01; September 26th, 2012 at 07:39 AM.


  2. #2
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Apache POI - CREATE_NULL_AS_BLANK - how?

    I found the answer.
    Seems like I typed in something wrong, and now it works.

  3. #3
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Apache POI - CREATE_NULL_AS_BLANK - how?

    Hmm, okey maybe still I hve a question about it.
    I solved it with:

    // 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....

  4. #4
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default 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?

Similar Threads

  1. [SOLVED] Apache POI - XSSFCell
    By Purple01 in forum Java SE APIs
    Replies: 1
    Last Post: September 18th, 2012, 03:33 AM
  2. Working with Apache and .JSP
    By mikeb2623 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 25th, 2011, 03:16 PM
  3. Apache POI
    By PineAppleKing in forum What's Wrong With My Code?
    Replies: 10
    Last Post: May 31st, 2011, 01:12 PM
  4. Problem with apache xml-rpc lib
    By tah_206207 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 22nd, 2011, 03:31 PM
  5. apache-jboss
    By supriya ramjee in forum Web Frameworks
    Replies: 0
    Last Post: August 12th, 2009, 06:37 AM