title: STRING cannot be resolved or is not a field
body: <p><strong>ERROR :</strong>
  Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
  STRING cannot be resolved or is not a field,NUMERIC cannot be resolved or is not a field,BOOLEAN cannot be resolved or is not a field,BLANK cannot be resolved or is not a field. I am using below code.</p>
  
  <pre><code>import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.util.Iterator; 
  import org.apache.poi.hssf.usermodel.HSSFCell;
  import org.apache.poi.hssf.usermodel.HSSFRow;
  import org.apache.poi.hssf.usermodel.HSSFSheet;
  import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  import org.apache.poi.ss.usermodel.Cell;
  import org.apache.poi.ss.usermodel.Row;
  import org.apache.poi.ss.usermodel.Sheet;
  import org.apache.poi.ss.usermodel.Workbook;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  public class ExcelReader {
  
      public static void main(String[] args) throws Exception {
          String filename = "test.xlsx";
  
          try (FileInputStream fis = new FileInputStream(filename)) {
              HSSFWorkbook workbook = new HSSFWorkbook(fis);
              HSSFSheet sheet = workbook.getSheetAt(0);
  
              Iterator rows = sheet.rowIterator();
              while (rows.hasNext()) {
                  HSSFRow row = (HSSFRow) rows.next();
                  Iterator&lt;Cell&gt; cells = row.cellIterator();
                  while (cells.hasNext()) {
                      HSSFCell cell = (HSSFCell) cells.next();
  
                      org.apache.poi.ss.usermodel.CellType type = cell.getCellTypeEnum();
                      if (type == CellType.STRING) {
                          System.out.println("[" + cell.getRowIndex() + ", "
                                  + cell.getColumnIndex() + "] = STRING; Value = "
                                  + cell.getRichStringCellValue().toString());
                      } else if (type == CellType.NUMERIC) {
                          System.out.println("[" + cell.getRowIndex() + ", "
                                  + cell.getColumnIndex() + "] = NUMERIC; Value ="
                                  + cell.getNumericCellValue());
                      } else if (type == CellType.BOOLEAN) {
                          System.out.println("[" + cell.getRowIndex() + ", "
                                  + cell.getColumnIndex() + "] = BOOLEAN; Value ="
                                  + cell.getBooleanCellValue());
                      } else if (type == CellType.BLANK) {
                          System.out.println("[" + cell.getRowIndex() + ", "
                                  + cell.getColumnIndex() + "] = BLANK CELL");
                      }
                  }
              }
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>