Comments (7)
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.
@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.
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.
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.
Row.CREATE_NULL_AS_BLANK not working
from excel-streaming-reader.
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.
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)
- Is there a way to get images and mergeCells? HOT 2
- ZipPackage still use much Jvm Heap
- The supplied data appears to be in the OLE2 Format HOT 2
- Getting org.apache.poi.xssf.model.SharedStringsTable.getEntryAt(I) Error with POI 5.0.0 HOT 4
- New release planned with Apache POI 5.x (4.1.2 contains vulnerabilities)? HOT 1
- spliterator is not supported with Apache POI 5.2.0 (Unsupported operation getPhysicalNumberOfRows) HOT 1
- 内存溢出问题
- StreamingWorkbook#getSheetIndex(String) and StreamingWorkbook#getSheet(String) behavior is inconsistent with poi-ooxml HOT 6
- This cannot be used for reading which has image HOT 1
- Can I get data formateed value from a numberic cell HOT 2
- Can I get data formateed value from a numberic cell
- NoSuchMethodError on getSharedStringsTable HOT 1
- FileNotFoundException exception for MultipartFile resource file
- Unable to read xlsx file using Excel steaming reader HOT 2
- read picture HOT 5
- Unable read excell cell text if cell has line break HOT 1
- Is this project still active or should we look for alternatives? HOT 3
- High CPU utilisation spikes recorded HOT 3
- Unable to load the cells which are blank HOT 5
- Unable to read large excel files HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excel-streaming-reader.