kode

kode

<? Php
ini_set ('display_errors', 1);
require_once ( 'PHPExcel.php');
require_once ( 'PHPExcel / IOFactory.php');
include_once ( '../../../ WP-load.php');
$ objPHPExcel = nuwe PHPExcel ();
globale $ wpdb;
// $ objPHPExcel-> getActiveSheet ();

$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A1', 'Donation Reports');
$ objPHPExcel-> setActiveSheetIndex (0) -> mergeCells ('A1: C1', ");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A2', 'SI');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('B2', 'Project');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('C2', 'Subproject');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('D2', 'Location');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('E2', 'Total');

$ file = 'Donation'. tyd (). '.xlsx'; //
// $ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007');
// $ objWriter-> save ("upload / excelsheet /". $ file);
// Hernoem werkblad
$ objPHPExcel-> getActiveSheet () -> setTitle ('Price Matrix');

// Stel aktiewe vel-indeks in die eerste vel, sodat Excel dit as die eerste vel oopmaak
$ ObjPHPExcel-> setActiveSheetIndex (0);

$ startdate = $ _REQUEST ['exportstartdate']. ' 00: 00: 00 ';
$ enddate = $ _REQUEST ['exportendate']. ' 00: 00: 00 ';

$ queryexport = ("SELECT". $ wpdb-> prefix. "user_donating. *,". $ wpdb-> prefix. "keuses. *, som (". $ wpdb-> voorvoegsel. "user_donating.total_amt) as totale bedrag FROM ". $ Wpdb-> voorvoegsel." User_donating.selection_id = ". $ Wpdb-> voorvoegsel." Selections.uniqetime_id WHERE posted_date tussen ''. $ begin datum. '' EN '". $ einddatum."' GROEP volgens projek, sub_projek, ligging ");

$ result = mysql_query ($ queryexport);
$ header = ";
$ i = 3;
$ j = 1;

terwyl ($ row = mysql_fetch_array ($ resultaat)) {
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('A'. $ i, $ j);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('B'. $ i, $ row ['projek']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('C'. $ i, $ row ['sub_project']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('D'. $ i, $ row ['location']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('E'. $ i, '£' .number_format ($ row ['totalamount'], 2));

$ I ++;
$ J ++;
}

$ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007');
$ objWriter-> save ("upload / excelsheet /". $ file);
$ file_url = 'upload / excelsheet /'.$ lêer;

koptekst ('Content-Type: application / vnd.openxmlformats-officedocument.spreadsheetml.sheet');
koptekst ("Inhoudsopgawe: aanhangsel; lêernaam =". $ lêer);
koptekst ("Cache-kontrole: moet-vervalleer, na-tjek = 0, pre-check = 0");
ob_end_clean ();
readfile ($ file_url);
uitgang;

?>

Nood te help? Klik hier vir aanlyn hulp