DataObjects/Core_domain.php
[Pman.Core] / SimpleExcel.php
index e22feb7..c3603ef 100644 (file)
@@ -186,7 +186,7 @@ class Pman_Core_SimpleExcel extends Pman
         $this->worksheet = $worksheet;
          
         $start_row = 0;
-        print_r($cfg);exit;
+        
         if (!empty($cfg['head'])) {
             foreach($cfg['head'] as $row) { 
                 foreach($row as $c => $col) {
@@ -299,7 +299,10 @@ class Pman_Core_SimpleExcel extends Pman
             $worksheet->setRow($start_row +$r, $cfg['row_height']);
         }
         
-        foreach($cfg['cols']  as $c=>$col_cfg) {
+        $line_height = (isset($cfg['line_height'])) ? $cfg['line_height'] : 12;
+        $height = 0;
+        
+        foreach($cfg['cols']  as $c => $col_cfg) {
             
             if(isset($col_cfg['dataIndex']) && isset($cl[$col_cfg['dataIndex']])){
                 $v =    $cl[$col_cfg['dataIndex']]  ;
@@ -343,6 +346,12 @@ class Pman_Core_SimpleExcel extends Pman
           
                 $worksheet->write($start_row+$r, $c, $v, $format);
             }
+            
+            if(isset($col_cfg['autoHeight'])){
+                $vv = explode("\n", $v);
+                $height = MAX(count($vv) * $line_height, $height);;
+                $worksheet->setRow($start_row+$r, $height);
+            }
         }
         $this->start_row++;
         
@@ -358,8 +367,10 @@ class Pman_Core_SimpleExcel extends Pman
         }
         
         require_once 'File/Convert.php';
+        //var_Dump($this->outfile2);
         $fc=  new File_Convert($this->outfile2, "application/vnd.ms-excel");
-        $fn = $fc->convert("application/vnd.ms-excel"); 
+        $fn = $fc->convert("application/vnd.ms-excel");
+        //print_r($fc);
         $fc->serve('attachment',$fname); // can fix IE Mess
     }