$semester = $_POST['semester']; $sy = $_POST['sy']; function HeaderingExcel($filename) { header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); } // HTTP headers HeaderingExcel('teacher.xls'); // Creating a workbook $workbook = new excel("-"); // Creating the first worksheet $worksheet1 =& $workbook->add_worksheet('teacher'); $worksheet1->freeze_panes(1, 0); $worksheet1->set_column(0, 0, 25); $worksheet1->set_column(1, 1, 20); $worksheet1->set_column(1, 2, 20); $worksheet1->set_column(1, 3, 20); $worksheet1->set_column(1, 4, 20); $worksheet1->set_column(1, 5, 20); $worksheet1->set_column(1, 6, 20); //row $worksheet1->set_row(8, 50); $query = mysql_query("select * from schedule where teacher='{$id_get}' and semester='{$semester}' and sy='{$sy}'") or die(mysql_error()); $row = mysql_fetch_array($query); $name = $row['teacher']; $sy = $row['sy']; $semester = $row['semester'];
require_once 'Worksheet.php'; require_once 'Workbook.php'; function HeaderingExcel($filename) { header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); } // HTTP headers HeaderingExcel('test.xls'); // Creating a workbook $workbook = new excel("-"); // Creating the first worksheet $worksheet1 =& $workbook->add_worksheet('First One'); $worksheet1->set_column(1, 1, 40); $worksheet1->set_row(1, 20); $worksheet1->write_string(1, 1, "This worksheet's name is " . $worksheet1->get_name()); $worksheet1->write(2, 1, "http://www.phpclasses.org/browse.html/package/767.html"); $worksheet1->write_number(3, 0, 11); $worksheet1->write_number(3, 1, 1); $worksheet1->write_string(3, 2, "by four is"); $worksheet1->write_formula(3, 3, "=A4 * (2 + 2)"); //$worksheet1->write_formula(3, 3, "= SUM(A4:B4)"); $worksheet1->write(5, 4, "= POWER(2,3)"); $worksheet1->write(4, 4, "= SUM(5, 5, 5)"); //$worksheet1->write_formula(4, 4, "= LN(2.71428)"); //$worksheet1->write_formula(5, 4, "= SIN(PI()/2)"); // Creating the second worksheet $worksheet2 =& $workbook->add_worksheet();