【问题标题】:how to set strikethrough effects for cell with Maatwebsite/Laravel-Excel?如何使用 Maatwebsite/Laravel-Excel 为单元格设置删除线效果?
【发布时间】:2018-10-26 17:19:30
【问题描述】:

我正在使用 Maatwebsite/Laravel-Excel 导出 xlsx 文件。 如何为类似单元格的图像设置删除线

我已阅读文档但无法解决。

我的代码(不工作):

    $sheet->cells("I5", function($cells) {
                $cells->setFont(array(
                    // 'underline'       =>  true
                    'strikethrough'=>true

                ));

            });

谢谢!

【问题讨论】:

    标签: php laravel-excel


    【解决方案1】:

    根据文档,您可以设置单元格或样式表 (https://laravel-excel.maatwebsite.nl/2.1/blade/styling.html) 的样式:

    // Set font with ->setStyle()`
    $sheet->setStyle(array(
        'font' => array(
            'name'      =>  'Calibri',
            'size'      =>  12,
            'bold'      =>  true,
            'strikethrough' => true,
        )
    ));
    

    它使用 PhpOffice / Spreadsheet,所以看看这个插件的文档:https://phpspreadsheet.readthedocs.io/en/develop/topics/recipes/

    【讨论】:

    猜你喜欢
    • 2018-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-10
    • 1970-01-01
    相关资源
    最近更新 更多