?
Path : /home/admin/domains/happytokorea.com/private_html/libs/excel/ |
Current File : /home/admin/domains/happytokorea.com/private_html/libs/excel/chkmail.php |
<?php #10/10/2006 Mathee Create require_once "class.writeexcel_workbook.inc.php"; require_once "class.writeexcel_worksheet.inc.php"; include("../../../../config.php"); include("../../../../libs/MySql.php"); require('../../../../libs/function.php'); $db=new MySql; $fname = tempnam("/tmp", "chkmail.xls"); $workbook = &new writeexcel_workbook($fname); # Some common formats $center =& $workbook->addformat(array('align' => 'center')); $left =& $workbook->addformat(array('align' => 'left')); $heading =& $workbook->addformat(array('align' => 'center', 'bold' => 1)); # Try this to see the default Excel 5 palette # $workbook->set_palette_xl5(); $worksheet1 =& $workbook->addworksheet('chkmail'); $header_array=Array('Email','Company','Name','Type','Status','From'); $worksheet1->set_column(0,6, 18); //write Header $k=0; foreach($header_array as $v){ $worksheet1->write(0, $k, $v, $heading); $k++; } //load Data from db $db->setQuery("SELECT * FROM chkmail WHERE mail_id='{$_GET['id']}'"); $rs=$db->QueryReturn(); $i = 0; $j=0; while($data=mysql_fetch_array($rs)){ $format =& $workbook->addformat(array( 'pattern' => 1, 'border' => 1 )); $worksheet1->write($j+1, 0,$data['email'],$left); $worksheet1->write($j+1, 1,$data['company'],$left); $worksheet1->write($j+1, 2,$data['name'],$left); $worksheet1->write($j+1, 3,$data['type'],$left); $worksheet1->write($j+1, 4,$data['status'],$left); $worksheet1->write($j+1, 5,$data['fromname'],$left); $j++; } $workbook->close(); header("Content-Type: application/x-msexcel; name=\"chckmail.xls\""); header("Content-Disposition: inline; filename=\"chckmail.xls\""); $fh=fopen($fname, "rb"); fpassthru($fh); unlink($fname); ?>