getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") ->setSubject("Office 2007 XLSX Test Document") ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") ->setKeywords("office 2007 openxml php") ->setCategory("Test result file"); $num = 1; $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A'.$num, 'Mr/Mrs/Miss *') ->setCellValue('B'.$num, 'Name *') ->setCellValue('C'.$num, 'Father/Husband *') ->setCellValue('D'.$num, 'Name(Father/Husband) *') ->setCellValue('E'.$num, 'Date Of Birth *') ->setCellValue('F'.$num, 'Marriage Anniversary') ->setCellValue('G'.$num, 'Number of Person in Family-(Adult 10 & above) ') ->setCellValue('H'.$num, 'Number of Person in Family-Child(0 & 10) ') ->setCellValue('I'.$num, 'Area Catagory *') ->setCellValue('J'.$num, 'Sub Catagory *') ->setCellValue('K'.$num, 'Plot No. *') ->setCellValue('L'.$num, 'Address *') ->setCellValue('M'.$num, 'Mobile(s)') ->setCellValue('N'.$num, 'Mobile(WhatsUp)') ->setCellValue('O'.$num, 'Land Line ') ->setCellValue('P'.$num, 'E-mail') ->setCellValue('Q'.$num, 'Any Person have suger disease '); // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('Simple'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); // Redirect output to a client’s web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="customers.xls"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); exit; } if(isset($_POST[$_SESSION['exportpurchaselist']])) { error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); date_default_timezone_set('Europe/London'); if (PHP_SAPI == 'cli') die('This example should only be run from a Web Browser'); /** Include PHPExcel */ require_once 'Classes/PHPExcel.php'; // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document prope rties $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") ->setSubject("Office 2007 XLSX Test Document") ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") ->setKeywords("office 2007 openxml php") ->setCategory("Test result file"); $num = 1; $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A'.$num, 'Date') ->setCellValue('B'.$num, 'Item Name ') ->setCellValue('C'.$num, 'Quantity') ->setCellValue('D'.$num, 'Amount'); $num = 2; $quer = mysql_query("SELECT * FROM item_purchase_req where mode = 1 "); while($row = mysql_fetch_array($quer)) { $id = $row['id']; $item_id = $row['item_id']; $mode = $row['mode']; $quantity = $row['quantity']; $weight_type = $row['weight_type']; $date = $row['date']; $time = $row['time']; $query = mysql_query("SELECT * FROM item where id = '$item_id' "); while($rrr = mysql_fetch_array($query)) { $item_name = $rrr['item_name']; } if($weight_type == 1 or $weight_type == 2) { $quantities = $quantity/1000; } else { $quantities = $quantity; } $query = mysql_query("SELECT * FROM weight_type where id = '$weight_type' "); while($rrr = mysql_fetch_array($query)) { $weight_type_name = $rrr['weight_name']; } $dfdfgd = $quantities." ".$weight_type_name; $objPHPExcel->setActiveSheetIndex(0) ->setCellValue('A'.$num, $date) ->setCellValue('B'.$num, $item_name) ->setCellValue('C'.$num, $dfdfgd) ->setCellValue('D'.$num, 0); $num++; } // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('Simple'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); // Redirect output to a client’s web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="purchaseorder.xls"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); exit; } mysql_close();