title: How do I read the cell contents using apache poi for xlsx type of excel file?
body: <p>It seems I'm in a bit of a pickle, I read various topics about read xls files with hssf but I can't seem to find good xssf tutorials and it's really hard since they have different statements. My code is supposed to read the row 2, column 2 but I get a "getContents() is undefined for the type XSSFComment" error </p>
  
  <p>My code goes something like: </p>
  
  <pre><code>import java.io.FileOutputStream; 
  import java.io.IOException; 
  import java.io.InputStream; 
  
  import org.apache.poi.xssf.usermodel.XSSFCell; 
  import org.apache.poi.xssf.usermodel.XSSFRow; 
  import org.apache.poi.xssf.usermodel.XSSFSheet; 
  import org.apache.poi.xssf.usermodel.XSSFWorkbook; 
  
  public class parsing{ 
  
  public static void main(String[] args) throws IOException { 
  InputStream ExcelFileToRead = new FileInputStream("C:/test.xlsx"); 
  XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead); 
  XSSFSheet sh = wb.getSheetAt(0); 
  System.out.println(sh.getCellComment(1,1).getContents()); 
  } 
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
      The method getContents() is undefined for the type XSSFComment
      at parsing.main(parsing.java:18)
  </code></pre>