title: Styling cell borders with PhpSpreadsheet PHP
body: <p>I use PhpSpreadsheet to read o write in Excel files. I want to add to my excel a border style so I used this code:</p>
  
  <pre><code>&lt;?php
      $fxls ='myfile.xlsx';
      $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($fxls);
      $xls_data = $spreadsheet-&gt;getActiveSheet()-&gt;toArray(null, true, true, true);
      $sheet = $spreadsheet-&gt;getActiveSheet();
  
      $styleArray = array(
          'borders' =&gt; array(
              'outline' =&gt; array(
                  'borderStyle' =&gt; \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
                  'color' =&gt; array('argb' =&gt; 'FFFF0000'),
              ),
          ),
      );
  
      $sheet -&gt;getStyle('B2:G8')-&gt;applyFromArray($styleArray);
  
      /* Generate the Excel File */
      header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
      header('Content-Disposition: attachment;filename="myNEWFile.xlsx"');
      header('Cache-Control: max-age=0');
      header('Cache-Control: max-age=1');
      header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
      header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
      header ('Cache-Control: cache, must-revalidate');
      header ('Pragma: public');
      $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
      $writer-&gt;save('php://output');
      exit;
  </code></pre>
  
  <p>I get no error but the excel file is created without border. What I miss !??</p>