public function test2Action()
 {
     try {
         WordChart::scatter_horiz_Graph_cpi();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
 public function checkoutCpi($examinee, $objActSheet)
 {
     $objActSheet->getDefaultRowDimension()->setRowHeight(16);
     $objActSheet->getDefaultColumnDimension()->setWidth(12);
     $objActSheet->mergeCells('A1:F1');
     $objActSheet->setCellValue('A1', '青年性格问卷(CPI)测试结果');
     $objActSheet->getStyle('A1')->getFont()->setBold(true);
     $this->position($objActSheet, 'A1');
     $objActSheet->setCellValue('A2', '分类号');
     $this->position($objActSheet, 'A2');
     $objActSheet->mergeCells('B2:F2');
     $objActSheet->setCellValue('A3', '编号');
     $this->position($objActSheet, 'A3');
     $objActSheet->setCellValue('B3', $examinee->number);
     $this->position($objActSheet, 'B3');
     $objActSheet->setCellValue('C3', '姓名');
     $this->position($objActSheet, 'C3');
     $objActSheet->setCellValue('D3', $examinee->name);
     $this->position($objActSheet, 'D3');
     $objActSheet->setCellValue('E3', '性别');
     $this->position($objActSheet, 'E3');
     $objActSheet->setCellValue('F3', $examinee->sex == "1" ? "男" : "女");
     $this->position($objActSheet, 'F3');
     $objActSheet->setCellValue('A4', '年龄');
     $this->position($objActSheet, 'A4');
     $age = floor(FactorScore::calAge($examinee->birthday, $examinee->last_login));
     $objActSheet->setCellValue('B4', $age);
     $this->position($objActSheet, 'B4');
     $objActSheet->setCellValue('C4', '职业');
     $this->position($objActSheet, 'C4');
     $objActSheet->setCellValue('D4', $examinee->duty);
     $this->position($objActSheet, 'D4');
     $objActSheet->setCellValue('E4', '测试日期');
     $this->position($objActSheet, 'E4');
     $date = explode(' ', $examinee->last_login)[0];
     $objActSheet->setCellValue('F4', $date);
     $this->position($objActSheet, 'F4');
     $styleArray = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $objActSheet->getStyle('A2:F4')->applyFromArray($styleArray);
     $objActSheet->mergeCells('A5:F5');
     $objActSheet->setCellValue('B6', '因子名称');
     $this->position($objActSheet, 'B6');
     $objActSheet->setCellValue('C6', '代号');
     $this->position($objActSheet, 'C6');
     $objActSheet->setCellValue('D6', '原始分');
     $this->position($objActSheet, 'D6');
     $objActSheet->setCellValue('E6', 'T分');
     $this->position($objActSheet, 'E6');
     $styleArray = array('borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
     $objActSheet->getStyle('A6:F6')->applyFromArray($styleArray);
     $data = CheckoutData::getCPIdata($examinee);
     if (empty($data)) {
         return;
     }
     $array1 = array('do', 'cs', 'sy', 'sp', 'sa', 'wb');
     $array2 = array('re', 'so', 'sc', 'po', 'gi', 'cm');
     $array3 = array('ac', 'ai', 'ie');
     $array4 = array('py', 'fx', 'fe');
     $objActSheet->mergeCells("A7:F7");
     $objActSheet->setCellValue('A7', '第一类  人际关系适应能力的测验');
     $objActSheet->getStyle('A7')->getFont()->setBold(true);
     $this->position($objActSheet, 'A7', 'left');
     $startRow = 7;
     $lastRow = $startRow;
     foreach ($array1 as $value) {
         if (isset($data[$value])) {
             $startRow++;
             $lastRow = $startRow;
             $objActSheet->setCellValue('B' . $startRow, $data[$value]['chs_name']);
             $this->position($objActSheet, 'B' . $startRow);
             $objActSheet->setCellValue('C' . $startRow, ucwords($value));
             $this->position($objActSheet, 'C' . $startRow);
             $objActSheet->setCellValue('D' . $startRow, $data[$value]['score']);
             $this->position($objActSheet, 'D' . $startRow);
             $objActSheet->setCellValue('E' . $startRow, $data[$value]['std_score']);
             $this->position($objActSheet, 'E' . $startRow);
         }
     }
     $objActSheet->getStyle('A7:F' . $lastRow)->applyFromArray($styleArray);
     $startRow++;
     $firstRow = $startRow;
     $lastRow = $startRow;
     $objActSheet->mergeCells('A' . $startRow . ':F' . $startRow);
     $objActSheet->setCellValue('A' . $startRow, '第二类  社会化、成熟度、责任心及价值观念的测验');
     $objActSheet->getStyle('A' . $startRow)->getFont()->setBold(true);
     $this->position($objActSheet, 'A' . $startRow, 'left');
     foreach ($array2 as $value) {
         if (isset($data[$value])) {
             $startRow++;
             $lastRow = $startRow;
             $objActSheet->setCellValue('B' . $startRow, $data[$value]['chs_name']);
             $this->position($objActSheet, 'B' . $startRow);
             $objActSheet->setCellValue('C' . $startRow, ucwords($value));
             $this->position($objActSheet, 'C' . $startRow);
             $objActSheet->setCellValue('D' . $startRow, $data[$value]['score']);
             $this->position($objActSheet, 'D' . $startRow);
             $objActSheet->setCellValue('E' . $startRow, $data[$value]['std_score']);
             $this->position($objActSheet, 'E' . $startRow);
         }
     }
     $objActSheet->getStyle('A' . $firstRow . ':F' . $lastRow)->applyFromArray($styleArray);
     $startRow++;
     $firstRow = $startRow;
     $lastRow = $startRow;
     $objActSheet->mergeCells("A" . $startRow . ":F" . $startRow);
     $objActSheet->setCellValue('A' . $startRow, '第三类  成就能力与智能效率的测验');
     $objActSheet->getStyle('A' . $startRow)->getFont()->setBold(true);
     $this->position($objActSheet, 'A' . $startRow, 'left');
     foreach ($array3 as $value) {
         if (isset($data[$value])) {
             $startRow++;
             $lastRow = $startRow;
             $objActSheet->setCellValue('B' . $startRow, $data[$value]['chs_name']);
             $this->position($objActSheet, 'B' . $startRow);
             $objActSheet->setCellValue('C' . $startRow, ucwords($value));
             $this->position($objActSheet, 'C' . $startRow);
             $objActSheet->setCellValue('D' . $startRow, $data[$value]['score']);
             $this->position($objActSheet, 'D' . $startRow);
             $objActSheet->setCellValue('E' . $startRow, $data[$value]['std_score']);
             $this->position($objActSheet, 'E' . $startRow);
         }
     }
     $objActSheet->getStyle('A' . $firstRow . ':F' . $lastRow)->applyFromArray($styleArray);
     $startRow++;
     $firstRow = $startRow;
     $lastRow = $startRow;
     $objActSheet->mergeCells("A" . $startRow . ":F" . $startRow);
     $objActSheet->setCellValue('A' . $startRow, '第四类  个人的生活态度与倾向的测验');
     $objActSheet->getStyle('A' . $startRow)->getFont()->setBold(true);
     $this->position($objActSheet, 'A' . $startRow, 'left');
     foreach ($array4 as $value) {
         if (isset($data[$value])) {
             $startRow++;
             $lastRow = $startRow;
             $objActSheet->setCellValue('B' . $startRow, $data[$value]['chs_name']);
             $this->position($objActSheet, 'B' . $startRow);
             $objActSheet->setCellValue('C' . $startRow, ucwords($value));
             $this->position($objActSheet, 'C' . $startRow);
             $objActSheet->setCellValue('D' . $startRow, $data[$value]['score']);
             $this->position($objActSheet, 'D' . $startRow);
             $objActSheet->setCellValue('E' . $startRow, $data[$value]['std_score']);
             $this->position($objActSheet, 'E' . $startRow);
         }
     }
     $objActSheet->getStyle('A' . $firstRow . ':F' . $lastRow)->applyFromArray($styleArray);
     $startRow++;
     $startRow++;
     //edit bruce_w 2015-12-9 分页打印
     $startRow += 20;
     $objActSheet->mergeCells("A" . $startRow . ":F" . $startRow);
     $objActSheet->setCellValue('A' . $startRow, '青年性格问卷测试(CPI)剖析图');
     $this->position($objActSheet, 'A' . $startRow);
     $objActSheet->getStyle('A' . $startRow)->getFont()->setBold(true);
     $startRow++;
     $filePath = WordChart::scatter_horiz_Graph_cpi($data, $examinee);
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setPath($filePath);
     $width = 15 * 39;
     $height = 20 * 39;
     $objDrawing->setWidthAndHeight($width, $height);
     $objDrawing->setCoordinates("A" . $startRow);
     $objDrawing->setWorksheet($objActSheet);
 }