PhpSpreadsheet怎么设置单元格边框

$styleArray = [
    'borders' => [
  		'allBorders' => [
            'borderStyle' => Border::BORDER_THIN //细边框
        ]
   	 ]
];
  
$worksheet->getStyle('A1:N1')->applyFromArray($styleArray);

说明:
$worksheetPhpOffice\PhpSpreadsheet\Worksheet的实例
$styleArrayborders数组中支持的key对应PhpOffice\PhpSpreadsheet\Style\Borders类的属性
allBorders数组中支持的key对应PhpOffice\PhpSpreadsheet\Style\Border类的属性

参考文档:
https://blog.csdn.net/jaray/article/details/9159147
https://phpoffice.github.io/PhpSpreadsheet/master/PhpOffice/PhpSpreadsheet/Style/Borders.html

你可能感兴趣的:(PHP)