title: Format The Cells For Entire Column In PHP Excel
body: <p>I have used the solution found within this  <a href="https://stackoverflow.com/questions/13307111/php-excel-set-whole-column-data-alignment-not-working/%22Answer%22">Answer</a>.</p>
  
  <p>The code I used looks like this: </p>
  
  <pre><code>  $objWorksheet-&gt;getColumnDimension("AM")-&gt;setWidth(20);
    $objWorksheet-&gt;SetCellValue("AM1", "Date1");
    $objWorksheet-&gt;getStyle("AM")
                   -&gt;getNumberFormat()
                     -&gt;setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
  </code></pre>
  
  <p>The one problem I had is when I select the entire column as such:</p>
  
  <p><a href="https://i.stack.imgur.com/pc5g4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pc5g4.png" alt="enter image description here"></a></p>
  
  <p>It still says "general".</p>
  
  <p>But when I select a range of columns from 0 to 4500 lets say:</p>
  
  <p><a href="https://i.stack.imgur.com/mQTQ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mQTQ3.png" alt="enter image description here"></a></p>
  
  <p>It shows up as "text".</p>
  
  <p>If set to "General" the dates are auto-formmated by Excel and read wrong into PHPExcel.</p>
  
  <p>Will these cells be read as "General" or as "Text"?</p>
  
  <p>Can I rely that they will always be read as "Text" using this method?</p>