apache poi - How to get an Excel Blank Cell As NULL -


i have value excel using apache poi. have 2 cases

  1. have exact value excel cell
  2. the null value should return while value

for first case have using new dataformatter().formatcellvalue(row.getcell(index)) method return value excel. if cell has empty value didn't return value null.

i tried new dataformatter().formatcellvalue(row.getcell(index, hssfrow.return_blank_as_null))

please refer attached screen shot! here have description value null excel null values

the point of datformatter give non-null string looks excel have displayed given cell. empty cell, null or blank, that's empty string. that's explained in javadocs formatcellvalue method:

when passed null or blank cell, method return empty string ("")

if want have null value empty cells, should tweak code be:

// 1 per workbook fine, save re-creating each time dataformatter formatter = new dataformatter();  // per cell cell c = row.getcell(index, row.return_blank_as_null); if (c == null) return null; return formatter.formatcellvalue(c); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -