-
Notifications
You must be signed in to change notification settings - Fork 7
/
exp_periode.php
61 lines (51 loc) · 1.86 KB
/
exp_periode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
error_reporting(E_ALL);
require_once '../plugins/excel/PHPExcel.php';
require_once '../config/config.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$query="select * from periode";
$hasil=mysql_query($query);
// Set properties
$objPHPExcel->getProperties()->setCreator("Muhammad Khoirul Umam")
->setLastModifiedBy("Muhammad Khoirul Umam")
->setTitle("Backup Data Periode")
->setSubject("Backup Data Periode")
->setDescription("Data Periode")
->setKeywords("Data Periode")
->setCategory("Periode");
// Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'No.')
->setCellValue('B1', 'Nama Periode')
->setCellValue('C1', 'Tgl Berangkat')
->setCellValue('D1', 'Tgl Kembali')
->setCellValue('E1', 'Thn Angkatan')
->setCellValue('F1', 'Jumlah Kelas');
$baris=2;
$no=0;
$nomer=1;
while($row=mysql_fetch_array($hasil)){
$no=$no 1;
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue("A$baris", $nomer)
->setCellValue("B$baris", $row['nama_periode'])
->setCellValue("C$baris", $row['tgl_berangkat'])
->setCellValue("D$baris", $row['tgl_kembali'])
->setCellValue("E$baris", $row['thn_angkatan'])
->setCellValue("F$baris", $row['jml_kelas']);
$baris = $baris 1;
$nomer ;
}
// Rename sheet
$objPHPExcel->getActiveSheet()->setTitle('Periode');
// 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="Data Periode.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
?>