title: PHP Excel set column width
body: <p>I tried to apply <a href="https://stackoverflow.com/questions/16761897/phpexcel-auto-size-column-width">this solution</a> on my issue but with no results.</p>
  
  <p>The columns of my excel file are not all of the desired width. What I don't understand is that for some of them the max width is on the header row and is not coming from a formula of any type.</p>
  
  <p>My code to set the width:</p>
  
  <pre><code>$ews-&gt;setAutoFilter($ews-&gt;calculateWorksheetDimension());
  //formatto le colonne per la larghezza automatica
  foreach(range('A','EK') as $columnID) {
      $ews-&gt;getColumnDimension($columnID)-&gt;setAutoSize(true);
  }
  </code></pre>
  
  <p>In his answer @Mark Baker is saying that to get a more reilable result we should use this method:</p>
  
  <pre><code>PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
  </code></pre>
  
  <p>even if it is slower and is not for all the output file format (mine is xlsx so it's ok). What I miss is where I should enable this AutoSizeMethod in my code.
  EDIT: tried to edit my code so:
  PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
      $ews->setAutoFilter($ews->calculateWorksheetDimension());
      //formatto le colonne per la larghezza automatica
      foreach(range('A','EK') as $columnID) {
          $ews->getColumnDimension($columnID)->setAutoSize(true);
      }
  but nothing change in column width</p>