Giter Club home page Giter Club logo

Comments (7)

andreasellervee avatar andreasellervee commented on August 23, 2024 1

I had a similar issue, I solved it like this:

Cell cell = row.getCell(i);
if (cell == null) {
cell = new StreamingCell(i, row.getRowNum());
}

this just creates a StreamingCell with null value and you can go from there.

edit// formatting (indentation does not seem to work here)

from excel-streaming-reader.

jhhino avatar jhhino commented on August 23, 2024 1

@andreasellervee thank you so much for your post. It helped me a lot. I was at the same issue and I could fix it by using your solution.
I realized when we use StreamingReader and iterate cells of a row, it does not consider cells with blank value, shifting to the next cell with valid value and messing the rest of columns out.

Just to exempify, I was considering the code below:

for (Row row : reader) {
            String[] recordArray = new String[totalColumns];
            int columnSheet = 0;
            for (Cell cell : row) {
                recordArray[columnSheet] = cell.getStringCellValue();
                columnSheet++;
            }

            listRegistration.add(recordArray);
        }

than I've changed to this, in order to work well:

for (Row row : reader) {
            String[] recordArray = new String[totalColumns];
            int columnSheet = 0;
            for (int i=0; i<totalColumns; i++) {
                Cell cell = row.getCell(i);
                if (cell == null) {
                    cell = new StreamingCell(i, row.getRowNum());
                }
                recordArray[columnSheet] = cell.getStringCellValue();
                columnSheet++;
            }

            listRegistration.add(recordArray);
        }

from excel-streaming-reader.

dlandis avatar dlandis commented on August 23, 2024 1

@waxxxd

Any thoughts on implementing setMissingCellPolicy:

  @Override
  public void setMissingCellPolicy(MissingCellPolicy missingCellPolicy) {
    throw new UnsupportedOperationException();
  }

on StreamingWorkbook? Then it wouldn't have to be passed in for every getCell call.

from excel-streaming-reader.

waxxxd avatar waxxxd commented on August 23, 2024

Hello abhilashreddy1289

Cell cell = row.getCell(i, Row.CREATE_NULL_AS_BLANK) is now supported and resolves the issue.

Hope this is good news.

from excel-streaming-reader.

moisesf10 avatar moisesf10 commented on August 23, 2024

Row.CREATE_NULL_AS_BLANK not working

from excel-streaming-reader.

waxxxd avatar waxxxd commented on August 23, 2024

Can you confirm that you are using the latest maven version 1.1.0.

If you are please provide the sheet and code. Then we can help you.

from excel-streaming-reader.

waxxxd avatar waxxxd commented on August 23, 2024

Hello @dlandis

I haven't really looked into the code too much. Committed the change to fix a bug I had encountered in a personal project. Have a crack at it.

from excel-streaming-reader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.