thinkphp - phpExcel은 왜 수직선만 있는 테이블 테두리를 내보내나요?
我想大声告诉你
我想大声告诉你 2017-05-16 13:12:29
0
2
729

< /p>

공개 함수 Sincewriter($cart,$shopname) {
        $obj = 새로운 \PHPExcel();
        $obj->getProperties()->setCreator("JAMES")
            ->setLastModifiedBy("제임스")
            ->setTitle("zltrans")
            ->setSubject("도더")
            ->setDescription("주문 목록")
            ->setKeywords("Dorder")
            ->setCategory("테스트 결과 파일");

        $obj->getDefaultStyle()->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
        $obj->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objSheet = $obj->getActiveSheet();
        //상대행고
        $n = 'a';
        for ($i = 0; $i < 18; $i++) {
            $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(40);
            $objSheet->getColumnDimension($n++)->setWidth(12);
        }

        $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
        $obj->getActiveSheet()->getColumnDimension('F')->setWidth(25);

        //标题
        $obj->getActiveSheet()->mergeCells('A1:H1');

        $obj->getActiveSheet()->getStyle('A1')->getFont()->setSize(14);
        $obj->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);

        $obj->getActiveSheet()->setCellValue("A1", "优菜提货单签收单");


        $obj->getActiveSheet()->mergeCells('A2:D2');
        $obj->getActiveSheet()->setCellValue("A2", "提货站点:" . $shopname);

        $obj->getActiveSheet()->mergeCells('E2:H2');
        $obj->getActiveSheet()->setCellValue("E2", "출판 시간:" .date("Y-m-d"));

        $obj->getActiveSheet()->setCellValue("A4", "序号");
        $obj->getActiveSheet()->setCellValue("B4", "订单号");
        $obj->getActiveSheet()->setCellValue("C4", "金额");
        $obj->getActiveSheet()->setCellValue("D4", "提货确결정");

        $obj->getActiveSheet()->setCellValue("E4", "序号");
        $obj->getActiveSheet()->setCellValue("F4", "订单号");
        $obj->getActiveSheet()->setCellValue("G4", "金额");
        $obj->getActiveSheet()->setCellValue("H4", "提货确결정");

        $len = 5;
        $len2 = 5;

        $count = 개수($cart);

        foreach ($cart를 $key => $vo로) {

            if ($key < $count / 2 + 3) {
                $obj->getActiveSheet()->setCellValue("A" . $len, $key + 1);
                $obj->getActiveSheet()->setCellValue("B" . $len, $vo['orderid']);
                $obj->getActiveSheet()->setCellValue("C" . $len, ' ' . $vo['sum']);
                $obj->getActiveSheet()->setCellValue("D" . $len, '');
                $len++;
            } 또 다른 {
                $obj->getActiveSheet()->setCellValue("E" . $len2, $key + 1);
                $obj->getActiveSheet()->setCellValue("F" . $len2, $vo['orderid']);
                $obj->getActiveSheet()->setCellValue("G" . $len2, ' ' . $vo['sum']);
                $obj->getActiveSheet()->setCellValue("H" . $len2, ' ');
                $len2++;
            }
        }

        $hang = $len;

        $obj->getActiveSheet()->mergeCells('A' . $hang . ':B' . $hang);
        $obj->getActiveSheet()->setCellValue("A" . $hang, '优菜送货员签name送达');
        $obj->getActiveSheet()->mergeCells('C' . $hang . ':D' . $hang);
        $obj->getActiveSheet()->setCellValue("C" . $hang, '');


        $obj->getActiveSheet()->mergeCells('F' . $hang . ':H' . ($hang + 2));

        $hang++;
        $obj->getActiveSheet()->mergeCells('A' . $hang . ':C' . $hang);
        $obj->getActiveSheet()->setCellValue("A" . $hang, '本次동물품袋数:');
        $obj->getActiveSheet()->setCellValue('D' . $hang, $count);
        $obj->getActiveSheet()->setCellValue('E' . $hang, '袋');
        $hang++;
        $obj->getActiveSheet()->mergeCells('A' . $hang . ':B' . $hang);
        $obj->getActiveSheet()->setCellValue("A" . $hang, '本次提货点签name签收:');
        $obj->getActiveSheet()->mergeCells('C' . $hang . ':E' . $hang);
        $obj->getActiveSheet()->getStyle('A1:H' . $hang)->getBorders()->getAllBorders()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
        $이름 = 시간();
        header('콘텐츠 유형: application/vnd.ms-excel');
        header('콘텐츠 처리: attachment;filename="' . $name . '.xls"');
        header('캐시 제어: 최대 연령=0');
        $objWriter = \PHPExcel_IOFactory::createWriter($obj, 'Excel5');
        $objWriter->save('php://output');
    }

这一句是边框

 $obj->getActiveSheet()->getStyle('A1:H' . $hang)->getBorders()->getAllBorders()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN );
我想大声告诉你
我想大声告诉你

모든 응답(2)
东云奇侠

코드에는 문제가 없는 것 같지만 출력 Excel 버전에 문제가 있을 수 있습니다. $objWriter = PHPExcel_IOFactory::createWriter($obj, 'Excel2007');

추가로 다음을 수행하는 것이 가장 좋습니다. 추가: ob_end_clean(); 출력 전 //문자 깨짐을 방지하기 위해 버퍼 지우기

중국어 참조 매뉴얼:https://www.kancloud.cn/jingyifeng/phpexcel/363084


滿天的星座

다음 코드로 바꿔보세요:

으아악
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿