Laravel-excel: [QUESTION] CSS is supported with blade views ?

Created on 23 Mar 2018  ·  29Comments  ·  Source: Maatwebsite/Laravel-Excel

  • [ ] Able to reproduce the behaviour outside of your code, the problem is isolated to Laravel Excel.
  • [ ] Checked that your issue isn't already filed.
  • [ ] Checked if no PR was submitted that fixes this problem.

Versions

  • PHP version: 7.0
  • Laravel version: 5.5
  • Package version: 3.0

Description

I'm using this code :

<html>
    <h1>{{ $report->title }}</h1>
    <br/>
    <h2>{{ $report->description }}</h2>
    <br/>
    <p>{{ __('excel.dateLabel') }} {{ $date }}</p>
    <br/>
    <table>
        <thead>
            <tr>
                <th>{{ __('excel.firstColumn') }}</th>
                <th>{{ __('excel.secondColumn') }}</th>
                <th>{{ __('excel.thirdColumn') }}</th>
                <th>{{ __('excel.fourthColumn') }}</th>
            </tr>
        </thead>
    </table>
</html>

But when I would use class or style tag only background-color work. Color, font-weight.... not working.

Steps to Reproduce

<html>
    <h1>{{ $report->title }}</h1>
    <br/>
    <h2>{{ $report->description }}</h2>
    <br/>
    <p>{{ __('excel.dateLabel') }} {{ $date }}</p>
    <br/>
    <table>
        <thead>
            <tr>
                <th style="font-weight : bold">{{ __('excel.firstColumn') }}</th>
                <th>{{ __('excel.secondColumn') }}</th>
                <th>{{ __('excel.thirdColumn') }}</th>
                <th>{{ __('excel.fourthColumn') }}</th>
            </tr>
        </thead>
    </table>
</html>
help wanted

All 29 comments

3.0 doesn't support styling via blade views anymore. You should use PhpSpreadsheet method $worksheet->getStyle('B2:G8') to accomplish this.

Read in our docs how to call PhpSpreadsheet methods: https://laravel-excel.maatwebsite.nl/docs/3.0/export/extending

@patrickbrouwers Using