PHPExcel - 除了BORDER_THICK和BORDER_THIN之外,还有更多的边框样式
PHPExcel applyFromArray 除了BORDER_THICK和BORDER_THIN之外,PHPExcel还支持其他边框样式。
/* Border style */ const BORDER_NONE = 'none'; //去掉边框线 const BORDER_DASHDOT = 'dashDot'; //细虚线 ,一个点,一点长的虚线,类似这种(. _ . _ ) const BORDER_DASHDOTDOT = 'dashDotDot'; //细虚线,两个点,一点长的虚线,类似这种(.. _ .. _ ) const BORDER_DASHED = 'dashed'; //细 常规虚线 const BORDER_DOTTED = 'dotted'; //细 虚线 密度大 const BORDER_DOUBLE = 'double'; //双实线,类似这种(||) const BORDER_HAIR = 'hair'; //细 虚线 密度小 const BORDER_MEDIUMDASHDOT = 'mediumDashDot'; //中等虚线 ,一个点,一点长的虚线,类似这种(. _ . _ ) const BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'; //中等虚线,两个点,一点长的虚线,类似这种(.. _ .. _ ) const BORDER_MEDIUMDASHED = 'mediumDashed'; //中虚线 const BORDER_SLANTDASHDOT = 'slantDashDot'; //斜点,斜的虚线 const BORDER_THICK = 'thick'; //粗 实线 const BORDER_MEDIUM = 'medium'; //中等实线 const BORDER_THIN = 'thin'; //细 实线
vendor("PHPExcel.PHPExcel"); $objPHPExcel = new \PHPExcel(); $objActSheet = $objPHPExcel->getActiveSheet(); $styleArray1 = array( 'borders' => array( 'outline' => array(//四面边框(outline、allborders),指定一面边框(上面:top,下面:bottom,左面:left,右面:right) 'style' => \PHPExcel_Style_Border::BORDER_MEDIUM,//设置边框 组边框(BORDER_THICK) 细边框(BORDER_THIN) //'color' => array('rgb' => 'DDDDDD'),//设置边框颜色 ), ), ); $objActSheet->getStyle('A2:I5')->applyFromArray($styleArray1);