SimpleExcel.php
authorEdward <edward@roojs.com>
Mon, 9 Feb 2015 09:27:43 +0000 (17:27 +0800)
committerEdward <edward@roojs.com>
Mon, 9 Feb 2015 09:27:43 +0000 (17:27 +0800)
SimpleExcel.php

index bd14f80..31e3152 100644 (file)
@@ -299,7 +299,7 @@ class Pman_Core_SimpleExcel extends Pman
             $worksheet->setRow($start_row +$r, $cfg['row_height']);
         }
         
-        foreach($cfg['cols']  as $c=>$col_cfg) {
+        foreach($cfg['cols']  as $c => $col_cfg) {
             
             if(isset($col_cfg['dataIndex']) && isset($cl[$col_cfg['dataIndex']])){
                 $v =    $cl[$col_cfg['dataIndex']]  ;
@@ -343,6 +343,14 @@ class Pman_Core_SimpleExcel extends Pman
           
                 $worksheet->write($start_row+$r, $c, $v, $format);
             }
+            
+            if(isset($col_cfg['autoHeight'])){
+                $vv = explode("\n", $v);
+                
+                $height = count($vv) * 20;
+                
+                $worksheet->write($start_row+$r, $height);
+            }
         }
         $this->start_row++;