title: Determine MS Excel file type with Apache POI
body: <p>Is there a way to determine MS Office Excel file type in Apache POI? I need to know in what format is the Excel file: in Excel '97(-2007) (.xls) or Excel 2007 OOXML (.xlsx).</p>
  
  <p>I suppose I could do something like this:</p>
  
  <pre><code>int type = PoiTypeHelper.getType(file);
  switch (type) {
  case PoiType.EXCEL_1997_2007:
     ...
     break;
  case PoiType.EXCEL_2007:
     ...
     break;
  default:
     ...
  }
  </code></pre>
  
  <p>Thanks.</p>