讨论数量:
参考我写的
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$cellRange = 'A1:Z1';
// 所有表头-设置字体为12
$event->sheet->getDelegate()->getStyle($cellRange)->getFont()->setSize(12);
// 文字居中
$lastRow = $event->sheet->getDelegate()->getHighestRow();
// 跳转链接设置
$event->sheet->getDelegate()->getCell('B1')->getHyperlink()->setUrl('https://www.baidu.com');
}
];
}
github.com/mouyong/php-support/blo... 试试这个包。在 afterSheet 中调用下方代码就可以 * 红色,链接可点击
Excel:: handleRequireCellTextColorForRedAndHyperLink ($event);
参考我写的