Example #1
0
 function exporttoexcel()
 {
     error_reporting(0);
     if (!class_exists("PHPExcel", FALSE)) {
         $_qlas = dirname(dirname(__FILE__));
         require_once $_qlas . '/library/PHPExcel/Classes/PHPExcel.php';
         require_once $_qlas . '/library/PHPExcel/Classes/PHPExcel/Cell.php';
         require_once $_qlas . '/library/PHPExcel/Classes/PHPExcel/IOFactory.php';
     }
     $_qla8 = $this->ExportSettings;
     $_qO9e = $_qla8->_ql9g();
     $_qOat = new phpexcel();
     $_qOat->setactivesheetindex(0);
     $_qla7 = -1;
     $_qOa7 = -1;
     if (isset($this->Pager) && !$_qla8->IgnorePaging) {
         $_qla7 = $this->Pager->PageIndex * $this->Pager->PageSize;
         $_qOa7 = $_qla7 + $this->Pager->PageSize < $this->Pager->_ql8s ? $this->Pager->PageSize : $this->Pager->_ql8s - $_qla7;
     }
     $_qlai = $this->_qOa6($_qla7, $_qOa7);
     $ret = $_qlai->_qO58();
     $_qlau = 0;
     $_qOau = 1;
     foreach ($ret as $_qO5c) {
         foreach ($_qO5c as $_ql5e) {
             $_qO4 = $_ql5e->_qO53($_qla8->_ql9h(), $_qO9e["caseSensitive"]);
             $_qO4 = $_ql5e->_qO53();
             if ($_qO4 != "blank") {
                 $_qO5e = $_ql5e->_qO4s();
                 $_qO5g = $_ql5e->_qO4t();
                 $_qlav = phpexcel_cell::stringfromcolumnindex($_qlau) . $_qOau;
                 $_qOav = phpexcel_cell::stringfromcolumnindex($_qlau + $_qO5e - 1) . ($_qOau + $_qO5g - 1);
                 $_qOat->getactivesheet()->setcellvalue($_qlav, $_qO4);
                 if ($_qlav != $_qOav) {
                     $_qOat->getactivesheet()->mergecells($_qlav . ":" . $_qOav);
                     $_qOat->getactivesheet()->getstyle($_qlav)->getalignment()->setvertical(phpexcel_style_alignment::VERTICAL_CENTER);
                 }
             }
             $_qlau += 1;
         }
         $_qOau++;
         $_qlau = 0;
     }
     $_qOat->getactivesheet()->settitle($_qO9e["fileName"]);
     $_qOat->setactivesheetindex(0);
     ob_end_clean();
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename="' . $_qO9e["fileName"] . '.xls"');
     header('Cache-Control: max-age=0');
     header('Cache-Control: max-age=1');
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     header('Cache-Control: cache, must-revalidate');
     header('Pragma: public');
     $_qlaw = phpexcel_iofactory::createwriter($_qOat, 'Excel5');
     $_qlaw->save('php://output');
     exit;
 }