private function _folder_export($model, $map) { $list = $model->where($map)->select(); //导入thinkphp第三方类库 Vendor('Excel.PHPExcel'); //$inputFileName = "Public/templete/contact.xlsx"; //$objPHPExcel = PHPExcel_IOFactory::load($inputFileName); $objPHPExcel = new PHPExcel(); $objPHPExcel->getProperties()->setCreator("小微OA")->setLastModifiedBy("小微OA")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file"); // Add some data $i = 1; //dump($list); //编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", "编号")->setCellValue("B{$i}", "类型")->setCellValue("C{$i}", "标题")->setCellValue("D{$i}", "登录时间")->setCellValue("E{$i}", "部门")->setCellValue("F{$i}", "登录人")->setCellValue("G{$i}", "状态")->setCellValue("H{$i}", "审批")->setCellValue("I{$i}", "协商")->setCellValue("J{$i}", "抄送")->setCellValue("J{$i}", "审批情况"); foreach ($list as $val) { $i++; //dump($val); $id = $val['id']; $doc_no = $val["doc_no"]; //编号 $name = $val["name"]; //标题 $confirm_name = strip_tags($val["confirm_name"]); //审批 $consult_name = strip_tags($val["consult_name"]); //协商 $refer_name = strip_tags($val["refer_name"]); //协商 $type_name = $val["type_name"]; //流程类型 $user_name = $val["user_name"]; //登记人 $dept_name = $val["dept_name"]; //不美分 $create_time = $val["create_time"]; $create_time = toDate($val["create_time"], 'Y-m-d H:i:s'); //创建时间 $step = show_step_type($val["step"]); // //编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $doc_no)->setCellValue("B{$i}", $type_name)->setCellValue("C{$i}", $name)->setCellValue("D{$i}", $create_time)->setCellValue("E{$i}", $dept_name)->setCellValue("F{$i}", $user_name)->setCellValue("G{$i}", $step)->setCellValue("H{$i}", $confirm_name)->setCellValue("I{$i}", $consult_name); $model_flow_field = D("FlowField"); $field_list = $model_flow_field->get_data_list($id); // dump($field_list); $k = 0; if (!empty($field_list)) { foreach ($field_list as $field) { $k++; $field_data = $field['name'] . ":" . $field['val']; $location = get_cell_location("J", $i, $k); $objPHPExcel->setActiveSheetIndex(0)->setCellValue($location, $field_data); } } } // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('流程统计'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); $file_name = "流程统计.xlsx"; // Redirect output to a client’s web browser (Excel2007) header("Content-Type: application/force-download"); header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header("Content-Disposition:attachment;filename =" . str_ireplace('+', '%20', URLEncode($file_name))); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); //readfile($filename); $objWriter->save('php://output'); exit; }
<span class="auto">意见</span> </li> <?php if (is_array($flow_log)) { $i = 0; $__LIST__ = $flow_log; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $item) { $mod = $i % 2; ++$i; ?> <li class="tbody"> <span style="width:90px;" class="text-center"><?php echo show_step_type($item["step"]); ?> </span> <span style="width:90px;" class="text-center"><?php echo $item["user_name"]; ?> </span> <span style="width:90px;" class="text-center"><?php echo todate($item["create_time"], 'Y-m-d'); ?> </span> <span style="width:90px;" class="text-center"><?php echo show_result($item["result"]); ?> </span> <span class="auto">