<?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 "}";
<font color=red>*</font> </p> <p> 政治面貌: <input id="zzmm" class="text" type="text" style="width: 200px" value="<?php echo $studentInfo->getZzmm(); ?> " name="studentInfo[zzmm]" /> <font color=red>*</font> </p> <p> 民族: <select name="studentInfo[nation]"> <?php require_once '../service/NationService.class.php'; $nationService = new NationService(); $nation_res = $nationService->QueryAllNation(); for ($i = 0; $i < count($nation_res); $i++) { $row = $nation_res[$i]; if ($row['nationId'] == $studentInfo->getNation()) { echo "<option selected value={$row['nationId']}>{$row['nationName']}</option>"; } else { echo "<option value={$row['nationId']}>{$row['nationName']}</option>"; } } ?> </select> </p> <p> 毕业学校:
// 加粗 $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(14); // 字体大小 $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED); // 文本颜色 $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(18); $objPHPExcel->getActiveSheet()->setCellValue('A2', '民族编号'); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(18); $objPHPExcel->getActiveSheet()->setCellValue('B2', '民族名称'); for ($i = 'A'; $i <= 'B'; $i++) { $objPHPExcel->getActiveSheet()->getStyle($i . '2')->getFont()->setBold(true); // 加粗 } //获取查询参数 //创建NationService实例 $nationService = new NationService(); $nationArray = $nationService->QueryPrintNationInfo(); for ($i = 0; $i < count($nationArray); $i++) { $objPHPExcel->getActiveSheet()->getRowDimension($i + 3)->setRowHeight(20); $nation = $nationArray[$i]; $objPHPExcel->getActiveSheet()->setCellValue('A' . ($i + 3), $nation['nationId']); $objPHPExcel->getActiveSheet()->setCellValue('B' . ($i + 3), $nation['nationName']); } $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setTitle('民族信息信息记录'); //保存到服务器 //$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); //$FileName=iconv('utf-8','gbk','PHP导出Excel.xls'); //$objWriter->save($FileName); //选中保存路径 $outputFileName = iconv('UTF-8', 'gb2312', '民族信息记录.xls');
<?php require_once '../service/NationService.class.php'; require_once '../phpbean/Nation.class.php'; $nationId = $_GET['nationId']; $nationService = new NationService(); $nation = $nationService->GetNation($nationId); /*使用 JSON数据格式返回*/ header('Content-type: text/json;charset=utf-8'); echo "{nationId:" . $nation->getNationId(); echo ",nationName:\"" . $nation->getNationName() . "\""; echo "}";
$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']); $objPHPExcel->getActiveSheet()->setCellValue('J' . ($i + 3), $studentInfo['telephone']); $objPHPExcel->getActiveSheet()->setCellValue('K' . ($i + 3), $studentInfo['zcxx']); $objPHPExcel->getActiveSheet()->setCellValueExplicit('L' . ($i + 3), $studentInfo['cardNumber'], PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->getActiveSheet()->setCellValue('M' . ($i + 3), $studentInfo['xjh']); $objDrawing = new PHPExcel_Worksheet_Drawing(); $objDrawing->setName('photo'); $objDrawing->setDescription('photo'); $objDrawing->setPath('..' . $studentInfo['photo']); $objDrawing->setResizeProportional(false); //取消按原图像缩放 $objDrawing->setHeight(68);