title: How to register after sheet (register) events in Laravel Excel 3.0
body: <p>I have used laravel excel version 2.1 previously . In version 2.0 cell designing was pretty easy . So  i started a new project in latest edition of laravel (5.5)
  and was shocked to know that we can't use laravel excel version 2.0 in this version of laravel . I installed latest version of laravel-excel 3.1 and sheet styling is totally different from the version larave-excel version 2.0 so  i dig into documentation i found this custom macros to style the sheet but it didn't work.</p>
  
  <p><strong>Here's the link for the laravel excel package being used</strong></p>
  
  <p><a href="https://laravel-excel.maatwebsite.nl/3.1/getting-started/" rel="nofollow noreferrer">Laravel Excel</a></p>
  
  <p>Here's my Export Class code</p>
  
  <p><strong>Export Class</strong>
      
  
  <pre><code>use Maatwebsite\Excel\Concerns\FromCollection;
  use Maatwebsite\Excel\Concerns\Exportable;
  use Maatwebsite\Excel\Concerns\WithHeadings;
  use Maatwebsite\Excel\Concerns\ShouldAutoSize;
  use Maatwebsite\Excel\Concerns\AfterSheet;
  use Maatwebsite\Excel\Concerns\WithEvents;
  
  class CollectionExport implements WithEvents,FromCollection, WithHeadings, ShouldAutoSize
  {
      use Exportable;
  
  
      /*************** Alternate Method **************************/
  
  
      //  public function registerEvents(): array
      // {
      //     return [
      //         AfterSheet::class    =&gt; function(AfterSheet $event) {
      //             $cellRange = 'A1:W1'; // All headers
      //             $event-&gt;sheet-&gt;getDelegate()-&gt;getStyle($cellRange)-&gt;getFont()-&gt;setSize(14);
      //         },
      //     ];
      // }
  
       public function registerEvents(): array
      {
          return [
              BeforeExport::class  =&gt; function(BeforeExport $event) {
                  $event-&gt;writer-&gt;setCreator('Patrick');
              },
              AfterSheet::class    =&gt; function(AfterSheet $event) {
                  $event-&gt;sheet-&gt;setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
  
                  $event-&gt;sheet-&gt;styleCells(
                      'A1:W1',
                      [
                          'borders' =&gt; [
                              'outline' =&gt; [
                                  'borderStyle' =&gt; \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
                                  'color' =&gt; ['argb' =&gt; 'FFFF0000'],
                              ],
                          ]
                      ]
                  );
              },
          ];
      }
  
      public function collection()
      {
          return collect([
              [
                  'name' =&gt; 'Povilas',
                  'surname' =&gt; 'Korop',
                  'email' =&gt; 'povilas@laraveldaily.com',
                  'twitter' =&gt; '@povilaskorop'
              ],
              [
                  'name' =&gt; 'Taylor',
                  'surname' =&gt; 'Otwell',
                  'email' =&gt; 'taylor@laravel.com',
                  'twitter' =&gt; '@taylorotwell'
              ]
          ]);
      }
  
      public function headings(): array
      {
          return [
              'Name',
              'Surname__',
              'Email',
              'Twitter',
          ];
      }
  
  
  
  }
  </code></pre>
  
  <p><strong>I'm calling this in a specific route</strong></p>
  
  <pre><code>return Excel::download(new CollectionExport(), 'export.xlsx');
  </code></pre>
  
  <p>This registerEvents method has no effect on the Excel file being created 
   Am I missing something or doing it wrong ?
  Thanks in Advance !!!
  P.S : - I have tried both methods for styling none of them effected the style of excel file </p>