title: When using PHPExcel, why is the autosize stretching my image?
body: <p>I am creating a spreadsheet using the <a href="https://github.com/PHPOffice/PHPExcel/wiki" rel="noreferrer">PHPExcel Class</a>. I have several columns of data. I am using the autosize method in order to have them take the size of the longest data value in each column.</p>
  
  <p>EDIT - Here is my full code to show more details:</p>
  
  <pre><code>require_once '../../Classes/PHPExcel.php';
  $objPHPExcel = new PHPExcel();
  $objPHPExcel-&gt;setActiveSheetIndex(0);
  
  // Adding values for Header Row
  $objPHPExcel-&gt;getActiveSheet()
              -&gt;setCellValue('A3', '#')
              -&gt;setCellValue('B3', 'Name')
              -&gt;setCellValue('C3', 'Email')
              -&gt;setCellValue('D3', 'Phone')
              -&gt;setCellValue('E3', 'Address')
              -&gt;setCellValue('F3', 'Date Registered');
  
  //Setting column values to the Listers Spreadsheet  
  $counter = 4;
  $entries_num = 1;          
  //while($listers_export_row = $listers_export_result-&gt;fetch_assoc()) {
  while($listers_export_row = $listers_export_result-&gt;fetch(PDO::FETCH_ASSOC)) {
      //Adding Numbers to Listers Spreadsheet (Column A)
      $objPHPExcel-&gt;setActiveSheetIndex(0)-&gt;setCellValue('A'.$counter, $entries_num);
  
      //Adding Names to Listers Spreadsheet (Column B)
      $objPHPExcel-&gt;setActiveSheetIndex(0)-&gt;setCellValue('B'.$counter, $listers_export_row['first_name'].' '.$listers_export_row['last_name']);
  
      //Adding Email to Listers Spreadsheet (Column C) 
      $objPHPExcel-&gt;setActiveSheetIndex(0)-&gt;setCellValue('C'.$counter, $listers_export_row['email']);
  
      //Adding Phone to Listers Spreadsheet (Column D)
      $objPHPExcel-&gt;setActiveSheetIndex(0)-&gt;setCellValue('D'.$counter, '('.$listers_export_row['phone_prefix'].')'.$listers_export_row['phone_first'].'-'.$listers_export_row['phone_last']);
  
      //Adding Address to Listers Spreadsheet (Column E) 
      $address = $listers_export_row['address'];
          if($listers_export_row['apt'] != '') { $address .= ' '.$listers_export_row['apt']; }
      $address .= ', '.$listers_export_row['city'].', '.$listers_export_row['state'].' '.$listers_export_row['zip_1'];
  
      $objPHPExcel-&gt;setActiveSheetIndex(0)-&gt;setCellValue('E'.$counter, $address);
  
      //Adding Date Registered to Listers Spreadsheet (Column F)  
      $objPHPExcel-&gt;setActiveSheetIndex(0)-&gt;setCellValue('F'.$counter, date('m/d/y',$listers_export_row['date_created']));
  
      $counter++;
      $entries_num++;
  }
  
  // Forces the spreadsheet to take the size of the longest value             
  for ($col = 'A'; $col != 'G'; $col++) { //Runs through all cells between A and E and sets to autosize
      $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension($col)-&gt;setAutoSize(true);
  }
  
  // Add a drawing to the worksheet
  
  $objDrawing = new PHPExcel_Worksheet_Drawing();
  $objDrawing-&gt;setResizeProportional(false);
  $objDrawing-&gt;setName('Logo');
  $objDrawing-&gt;setDescription('Logo');
  $objDrawing-&gt;setPath('../images/crl_logo.png');
  $objDrawing-&gt;setHeight(35);
  $objDrawing-&gt;setWorksheet($objPHPExcel-&gt;getActiveSheet());
  
  // Redirect output to a client’s web browser (Excel5)
  header('Content-Type: application/vnd.ms-excel');
  header('Content-Disposition: attachment;filename="Accounts - '.date('m.d.y',time()).'.xls"');
  header('Cache-Control: max-age=0');
  // If you're serving to IE 9, then the following may be needed
  header('Cache-Control: max-age=1');
  
  // If you're serving to IE over SSL, then the following may be needed
  header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
  header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  header ('Pragma: public'); // HTTP/1.0
  
  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
  $objWriter-&gt;save('php://output');
  exit;
  </code></pre>
  
  <p>This is what is occuring (It should only be as wide as the first column):
  <img src="https://i.stack.imgur.com/DjW1f.png" alt="enter image description here"></p>
  
  <p>I have removed the autosize method and it takes the correct size, so I know it is affecting the size of the image.</p>
  
  <p>How can I remove the autosize from the image but leave it applied for the columns of data? </p>