SimpleExcel.php
authorEdward <edward@roojs.com>
Wed, 12 Mar 2014 10:21:46 +0000 (18:21 +0800)
committerEdward <edward@roojs.com>
Wed, 12 Mar 2014 10:21:46 +0000 (18:21 +0800)
SimpleExcel.php

index 08e23fa..87ee303 100644 (file)
@@ -319,6 +319,8 @@ class Pman_Core_SimpleExcel extends Pman
             
             $dataFormat = empty($col_cfg['dataFormat']) ? '' : $col_cfg['dataFormat'];
            
+            $validator = $this->workbook->addValidator();
+            $validator->setFormula1('speaker!$A$1:$A$15');
             
             $format = isset($col_cfg['format'])  && isset($formats[$col_cfg['format']] )   ? $formats[$col_cfg['format']] : false;
           //  print_R(array($start_row+$r, $c, $v, $format));exit;
@@ -328,8 +330,8 @@ class Pman_Core_SimpleExcel extends Pman
                     $dataFormat == 'string' ) {
                 $worksheet->writeString($start_row+$r, $c, $v, $format);
             } else {
-                
-                $worksheet->write($start_row+$r, $c, $v, $format);
+                $worksheet->setValidation(0,0,0,0,$validator);
+//                $worksheet->write($start_row+$r, $c, $v, $format);
             }
         }
         $this->start_row++;