title: PHPExcel takes unreasonably long to create spreadsheet
body: <p>I am using PHPExcel to generate some pretty hefty spreadsheets on the fly for our users.  This seems to work fine until we start to get up to medium sized spreadsheets.  I have user that is trying to export a spreadsheet that is about 6000 rows with 11 columns and this is bringing my script to its knees.  Unfortunately because the spreadsheets are very dynamic there is no way to generate them ahead of time so I am stuck doing this on the fly for each user request.</p>
  
  <p>I have run some tests and it seems that adding the rows to the spreadsheets gets continually slower as the script proceeds.  For example the following is being reported by my error logging:</p>
  
  <pre><code>1st set of 1000 rows completes 13.34 Seconds into the script
  2nd set of 1000 rows completes 54.57 Seconds into the script
  3rd set of 1000 rows completes 135.33 Seconds into the script
  4th set of 1000 rows completes 250.60 Seconds into the script
  5th set of 1000 rows completes 394.53 Seconds into the script
  </code></pre>
  
  <p>I have adjusted the script to use the following code to add each row to the spreadsheet:</p>
  
  <pre><code>$sheet-&gt;fromArray($row_array, NULL, 'B' . $row_counter);
  </code></pre>
  
  <p>Instead of adding each cell individually, but have not seen any increase in speed.</p>
  
  <p>The total code to create each row and format it is:</p>
  
  <pre><code>if($row_counter % 2 == 0){
                          $active_color = $even;}
                      Else{
                          $active_color = $odd;}  
                      $sheet-&gt;getStyle('B' . $row_counter . ':' . chr($colspan_endletter) . $row_counter)-&gt;applyFromArray(
                          array('fill'    =&gt; array(
                                                      'type'      =&gt; PHPExcel_Style_Fill::FILL_SOLID,
                                                      'color'     =&gt; array('argb' =&gt; $active_color)
                                                  ),
                                'borders' =&gt; array(
                                                      'left'      =&gt; array('style' =&gt; PHPExcel_Style_Border::BORDER_MEDIUM),
                                                      'right'     =&gt; array('style' =&gt; PHPExcel_Style_Border::BORDER_MEDIUM)
                                                  )
                               )
                          );
                      $sheet 
                                  -&gt;getStyle('B' . $row_counter . ':' . chr($colspan_endletter) . $row_counter)
                                  -&gt;getAlignment()
                                  -&gt;setWrapText(true)
                                  -&gt;setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER)
                                  -&gt;setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
  </code></pre>
  
  <p>Any idea why this is killing my script, or a way to make it complete in a reasonable timeframe?</p>