title: How to add table heading drop-down with Apache Poi
body: <p>I'm generating Excel tables with Apache POI, but my generated tables lack the drop-down menu on each header that appear when I "format as table" in Excel itself.</p>
  
  <p>I'd like to generate this:</p>
  
  <p><img src="https://i.stack.imgur.com/lEMjc.png" alt="Table with menu button"></p>
  
  <p>But instead I get this:</p>
  
  <p><img src="https://i.stack.imgur.com/HUEys.png" alt="Table without menu button"></p>
  
  <p>I'm following <a href="http://thinktibits.blogspot.co.uk/2014/09/Excel-Insert-Format-Table-Apache-POI-Example.html" rel="noreferrer">this blog post</a>, and my code looks like this:</p>
  
  <pre><code>        XSSFTable table = sheet.createTable();
          table.setDisplayName("Data");
          CTTable ctTable = table.getCTTable();
          ctTable.setDisplayName("Data");
          ctTable.setId(1L);
          ctTable.setName("DATA");
          CTTableStyleInfo table_style = ctTable.addNewTableStyleInfo();
          table_style.setName("TableStyleMedium9");
          table_style.setShowColumnStripes(false);
          table_style.setShowRowStripes(true);
  </code></pre>
  
  <p>Each column is then created like this:</p>
  
  <pre><code>            CTTableColumn column = ctColumns.addNewTableColumn();
              column.setName(headers.get(i));
              column.setId(i + 1);
  </code></pre>
  
  <p>What am I missing?</p>