-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexcel_print.php
28 lines (21 loc) · 1009 Bytes
/
excel_print.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
<?php session_start(); ob_start();
#### Roshan's very simple code to export data to excel
#### Copyright reserved to Roshan Bhattarai - [email protected]
#### if you have any problem contact me at http://roshanbh.com.np
#### fell free to visit my blog http://php-ajax-guru.blogspot.com
//code to download the data of report in the excel format
$fn=$_GET['fn'].".xls";
//print_r($_SESSION['report_header']);
//exit;
include_once("classes/cls.report.excel.php");
//create the instance of the exportexcel format
$excel_obj=new ExportExcel("$fn");
//setting the values of the headers and data of the excel file
//and these values comes from the other file which file shows the data
$excel_obj->setHeadersAndValues($_SESSION['report_header'],$_SESSION['report_values']);
//now generate the excel file with the data and headers set
$excel_obj->GenerateExcelFile();
//print_r($_SESSION['report_values']);
unset($_SESSION['report_header']);
unset($_SESSION['report_values']);
?>