1

I'm using Maatwebsite/Laravel-Excel to export xlsx file. How to set strikethrough for cell like image

enter image description here

I have read document but can't resolve.

My code (not work):

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

                ));

            });

Thank!

1 Answers1

0

According to documentation, you can style your Cell or Stylesheet (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,
    )
));

It uses PhpOffice / Spreadsheet, so look the doc of this plugin : https://phpspreadsheet.readthedocs.io/en/develop/topics/recipes/

Vincent Decaux
  • 9,857
  • 6
  • 56
  • 84
  • could you help on this one https://stackoverflow.com/questions/65376745/laravel-excel-style-with-css-not-working-while-exporting-view – Saroj Shrestha Dec 21 '20 at 06:12