Yii框架中使用PHPExcel导出Excel文件(3)

                    ->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

                $objectPHPExcel->getActiveSheet()->getStyle('B3:G3' )

                    ->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

                $objectPHPExcel->getActiveSheet()->getStyle('B3:G3' )

                    ->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

                $objectPHPExcel->getActiveSheet()->getStyle('B3:G3' )

                    ->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

                $objectPHPExcel->getActiveSheet()->getStyle('B3:G3' )

                    ->getBorders()->getVertical()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

    

                //设置颜色

                $objectPHPExcel->getActiveSheet()->getStyle('B3:G3')->getFill()

                    ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF66CCCC');

                    

            }

            //明细的输出

            $objectPHPExcel->getActiveSheet()->setCellValue('B'.($n+4) ,$product->id);

            $objectPHPExcel->getActiveSheet()->setCellValue('C'.($n+4) ,$product->product_name);

            $objectPHPExcel->getActiveSheet()->setCellValue('D'.($n+4) ,$product->product_agent->name);

            $objectPHPExcel->getActiveSheet()->setCellValue('E'.($n+4) ,$product->unit);

            $objectPHPExcel->getActiveSheet()->setCellValue('F'.($n+4) ,$product->unit_price);

            $objectPHPExcel->getActiveSheet()->setCellValue('G'.($n+4) ,$product->library_count);

            //设置边框

            $currentRowNum = $n+4;

            $objectPHPExcel->getActiveSheet()->getStyle('B'.($n+4).':G'.$currentRowNum )

                    ->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

            $objectPHPExcel->getActiveSheet()->getStyle('B'.($n+4).':G'.$currentRowNum )

                    ->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

            $objectPHPExcel->getActiveSheet()->getStyle('B'.($n+4).':G'.$currentRowNum )

                    ->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

            $objectPHPExcel->getActiveSheet()->getStyle('B'.($n+4).':G'.$currentRowNum )

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/11221.html