Пример #1
0
<?php 
require_once '../service/StudentInfoService.class.php';
require_once '../phpbean/StudentInfo.class.php';
require_once '../service/NationService.class.php';
$nationService = new NationService();
$zkzh = $_GET['zkzh'];
$studentInfoService = new StudentInfoService();
$studentInfo = $studentInfoService->GetStudentInfo($zkzh);
/*使用 JSON数据格式返回*/
header('Content-type: text/json;charset=utf-8');
echo "{zkzh:\"" . $studentInfo->getZkzh() . "\"";
echo ",name:\"" . $studentInfo->getName() . "\"";
echo ",sex:\"" . $studentInfo->getSex() . "\"";
echo ",kslb:\"" . $studentInfo->getKslb() . "\"";
echo ",zzmm:\"" . $studentInfo->getZzmm() . "\"";
echo ",nation:\"" . $nationService->GetNation($studentInfo->getNation())->getNationName() . "\"";
echo ",byxx:\"" . $studentInfo->getByxx() . "\"";
echo ",hkszd:\"" . $studentInfo->getHkszd() . "\"";
echo ",address:\"" . $studentInfo->getAddress() . "\"";
echo ",telephone:\"" . $studentInfo->getTelephone() . "\"";
echo ",zcxx:\"" . $studentInfo->getZcxx() . "\"";
echo ",cardNumber:\"" . $studentInfo->getCardNumber() . "\"";
echo ",xjh:\"" . $studentInfo->getXjh() . "\"";
echo ",gysznj:\"" . $studentInfo->getGysznj() . "\"";
echo ",gesznj:\"" . $studentInfo->getGesznj() . "\"";
echo ",gssznj:\"" . $studentInfo->getGssznj() . "\"";
echo ",memo:\"" . $studentInfo->getMemo() . "\"";
echo ",photo:\"" . $studentInfo->getPhoto() . "\"";
echo "}";
Пример #2
0
     $objPHPExcel->getActiveSheet()->getStyle($i . '2')->getFont()->setBold(true);
     // 加粗
 }
 //获取查询参数
 $zkzh = !empty($_POST['zkzh']) ? $_POST['zkzh'] : "";
 $name = !empty($_POST['name']) ? $_POST['name'] : "";
 $kslb = !empty($_POST['kslb']) ? $_POST['kslb'] : "";
 $nation = !empty($_POST['nation']) ? $_POST['nation'] : 0;
 $byxx = !empty($_POST['byxx']) ? $_POST['byxx'] : "";
 $hkszd = !empty($_POST['hkszd']) ? $_POST['hkszd'] : "";
 $address = !empty($_POST['address']) ? $_POST['address'] : "";
 $telephone = !empty($_POST['telephone']) ? $_POST['telephone'] : "";
 $cardNumber = !empty($_POST['cardNumber']) ? $_POST['cardNumber'] : "";
 $xjh = !empty($_POST['xjh']) ? $_POST['xjh'] : "";
 //创建StudentInfoService实例
 $studentInfoService = new StudentInfoService();
 $studentInfoArray = $studentInfoService->QueryPrintStudentInfoInfo($zkzh, $name, $kslb, $nation, $byxx, $hkszd, $address, $telephone, $cardNumber, $xjh);
 for ($i = 0; $i < count($studentInfoArray); $i++) {
     $objPHPExcel->getActiveSheet()->getRowDimension($i + 3)->setRowHeight(50);
     $studentInfo = $studentInfoArray[$i];
     $objPHPExcel->getActiveSheet()->setCellValue('A' . ($i + 3), $studentInfo['zkzh']);
     $objPHPExcel->getActiveSheet()->setCellValue('B' . ($i + 3), $studentInfo['name']);
     $objPHPExcel->getActiveSheet()->setCellValue('C' . ($i + 3), $studentInfo['sex']);
     $objPHPExcel->getActiveSheet()->setCellValue('D' . ($i + 3), $studentInfo['kslb']);
     $objPHPExcel->getActiveSheet()->setCellValue('E' . ($i + 3), $studentInfo['zzmm']);
     require_once '../service/NationService.class.php';
     $nationService = new NationService();
     $objPHPExcel->getActiveSheet()->setCellValue('F' . ($i + 3), $nationService->GetNation($studentInfo['nation'])->getnationName());
     $objPHPExcel->getActiveSheet()->setCellValue('G' . ($i + 3), $studentInfo['byxx']);
     $objPHPExcel->getActiveSheet()->setCellValue('H' . ($i + 3), $studentInfo['hkszd']);
     $objPHPExcel->getActiveSheet()->setCellValue('I' . ($i + 3), $studentInfo['address']);