dpevsxjn809817 2019-01-18 17:41
浏览 63

使用数组中的行号将自定义样式设置为Laravel Excel工作表

I have a loop building an array that I'm dumping to excel and I've created an iterator that counts the rows I want and adds them to ```$boldRows`` array. This is so that I can get the rows I want to set custom styles, in this case Bold lettering.

So I have the row count from my data, then I build my sheet from the data array $allgroupResult.

The sheet prints out perfectly as far as data is concerned but it's not setting my $boldRows to bold font.

What am I doing wrong?

$boldRows = array();

$name = ' Export For:' . $id;

$build = Excel::create($name, function ($excel) use ($allgroupResult) {

    $excel->sheet('Export', function ($sheet) use ($allgroupResult) {

        $sheet->fromArray($allgroupResult);

        foreach ( $boldRows as $row )   {
            $cell_name = excelColumnFromNumber($row)."1";
            $sheet->getStyle( $cell_name )->getFont()->setBold( true );
        }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
    • ¥30 eclipse开启服务后,网页无法打开
    • ¥30 雷达辐射源信号参考模型
    • ¥15 html+css+js如何实现这样子的效果?
    • ¥15 STM32单片机自主设计
    • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
    • ¥15 不小心不正规的开发公司导致不给我们y码,
    • ¥15 我的代码无法在vc++中运行呀,错误很多
    • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
    • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000