DataObjects/Core_notify_recur.php
[Pman.Core] / SimpleExcel.php
index 09093e1..92bb0bb 100644 (file)
@@ -2,6 +2,11 @@
 
 /**
  * class to generate excel file from rows of data, and a configuration.
+ *
+ * usage :
+ *   $x = new Pman_Core_SimpleExcel(array())
+ *   $x->send($fn);
+ *
  * 
  * cfg:
  *     formats 
  *          
  *     workbook : nameof
  *
- *     headdata : [
+ *     head  : [
             [ "a", "b" ]
-            
-            e : f
-        ]
+            [],
+            [ "A", "B" ]
+        ],
  *     cols :  array(
             array(
                 'header'=> "Thumbnail",
@@ -94,11 +99,12 @@ class Pman_Core_SimpleExcel extends Pman
             $worksheet->setColumn ( $c, $c, $col_cfg['width'] / 5);
              
         }
+        $start_row++;
            //     DB_DataObject::debugLevel(1);
         foreach($data as $r=>$cl) {
             
             if (isset($cfg['row_height'])) {
-                $worksheet->setRow($start_row +1, $cfg['row_height']);
+                $worksheet->setRow($start_row +$r, $cfg['row_height']);
                }
             
             foreach($cfg['cols']  as $c=>$col_cfg) {
@@ -122,7 +128,7 @@ class Pman_Core_SimpleExcel extends Pman
                 $format = isset($col_cfg['format']) ? $formats[$col_cfg['format']] : false;
                 
           //    echo "<PRE>WRITE: ". htmlspecialchars(print_r(array($r+1, $c,$v), true));
-                $worksheet->write($start_row+1, $c, $v, $format);
+                $worksheet->write($start_row+$r, $c, $v, $format);
             }
         }