Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreamingRow.getFirstCellNum is not supported #49

Closed
dpogorelov opened this issue Aug 4, 2016 · 2 comments
Closed

StreamingRow.getFirstCellNum is not supported #49

dpogorelov opened this issue Aug 4, 2016 · 2 comments

Comments

@dpogorelov
Copy link

Hi,

I think it would be correct to implement also the row.getFirstCellNum almost by the same way as you implemented the row.row.getLastCellNum() method in #46 ticket. Here is the possible implementation (if I'm not wrong):
return (short) (cellMap.size() == 0 ? -1 : 1);

Thx in advance.

@monitorjbl
Copy link
Owner

I don't believe that implementation is correct. You need to return the column number of the first cell in the map. If you'd like to open a PR for this, I'd be happy to review it.

@dpogorelov
Copy link
Author

dpogorelov commented Aug 12, 2016

Yep, you're right. Sorry for the late answer. Having a look at the XSSFRow.getFirstCellNum():

public short getFirstCellNum() {
        return (short)(_cells.size() == 0 ? -1 : _cells.firstKey());
    }

implementation in the Apache POI we can see that the column number of the first cell should be first key in _cell map. Checking the XSSFRow.getCell(int cellnum) method we can notice that column indexes in the _cell map is 0 based indexes thus in our implementation we should return 0 instead of 1 as the first column index:

return (short) (cellMap.size() == 0 ? -1 : 0);

@monitorjbl please correct me if I'm wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants