xlsReader empty cell problem
in
Contributed Library Questions
•
2 years ago
i use this library:
I only get nullPointerException if a cell is empty,
I also tried:
if(reader.getString(row, 28) != null){
but then i get a nullPointerException on that line.
I get this in the console:
ERR, getString(): cell is null
ERR, isCellType(): given cell is null.
ERR, getString(): wrong celltype
hope someone can helps
- import de.bezier.data.*;
- import processing.pdf.*;
- XlsReader reader;
- ArrayList<Location> locations = new ArrayList<Location>();
- int totalDepartments = 0;
- int totalLocations;
- int plotX1, plotX2, plotY1, plotY2;
- void setup (){
- size(1000, 600);
- reader = new XlsReader( this, "../data/Taxonomy_exp.xls" ); // assumes file to be in the data folder
- loadData();
- plotX1 = 50;
- plotX2 = width-plotX1;
- plotY1 = 50;
- plotY2 = height-plotY1;
- println("totalLocations "+totalLocations);
- println("totalDepartments "+totalDepartments);
- }
- // . . . . . . . . . . . . . . . . . . . . . . .
- void draw(){
- }
- // . . . . . . . . . . . . . . . . . . . . . . .
- void loadData(){
- // Businesses tab
- reader.openSheet(1);
- reader.firstRow();
- // reader.nextRow();
- // set reader on first row, first cell
- //println(reader.getString());
- while (reader.hasMoreRows()) {
- reader.nextRow();
- int row = reader.getRowNum();
- int oruCode = reader.getInt(row, 0);
- String locationStr = reader.getString(row, 5);
- String reportsTo = reader.getString(row, 21);
- println("reportsTo "+reportsTo);
- //String email = reader.getString(row, 28);
- if(reader.getString(row, 28) != null){
- String email = reader.getString(row, 28);
- }
- //println("email "+email);
- Float FTE = reader.getFloat(row, 33);
- }
- }
2