{
// print_r($cfg);
require_once 'Spreadsheet/Excel/Writer.php';
- $pman = new Pman();
// Creating a workbook
- $outfile2 = $pman->tempName('xls');
+ $outfile2 = $this->tempName('xls');
// var_dump($outfile2);
$workbook = new Spreadsheet_Excel_Writer($outfile2);
//$workbook = new Spreadsheet_Excel_Writer();
+
+ $workbook->close();
+ $this->outfile2 = $outfile2;
+
+ }
+
+ function buildpage($workbook, $formats , $data,$cfg)
+ {
+ //echo '<PRE>'; print_R($cfg);
+
// Creating a worksheet
- $worksheet =& $workbook->addWorksheet($cfg['workbook']);
+ $worksheet = $workbook->addWorksheet($cfg['workbook']);
+ if (is_a($worksheet, 'PEAR_Error')) {
+ die($worksheet->toString());
+ }
+ //print_R($worksheet);
$worksheet->setInputEncoding('UTF-8');
-
-
+ foreach($cfg['cols'] as $c=>$col_cfg) {
+ if (is_string($col_cfg)) {
+ $cfg['cols'][$c] = array(
+ 'header' => $col_cfg,
+ 'dataIndex' => $col_cfg,
+ 'width' => 50,
+
+ );
+ }
+ }
foreach($cfg['cols'] as $c=>$col_cfg) {
+
+
+
$worksheet->write($start_row, $c, $col_cfg['header']);
$worksheet->setColumn ( $c, $c, $col_cfg['width'] / 5);
- $workbook->close();
- $this->outfile2 = $outfile2;
-
- }
-
- function buildpage($data,$cfg)
- {
-
-
-
}
-
-
function send($fn)
{
-
-
-
require_once 'File/Convert.php';
$fc= new File_Convert($this->outfile2, "application/vnd.ms-excel");
$fn = $fc->convert("application/vnd.ms-excel");