title: PhpSpreadsheet - Download file instead of saving it
body: <p>I need to generate an excel file (xls) and trigger the download after it is generated.
  I found this example in the <a href="https://phpspreadsheet.readthedocs.io/en/latest/" rel="noreferrer">documentation</a>.</p>
  
  <pre><code>&lt;?php
  
  require 'vendor/autoload.php';
  
  use PhpOffice\PhpSpreadsheet\Spreadsheet;
  use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  
  $spreadsheet = new Spreadsheet();
  $sheet = $spreadsheet-&gt;getActiveSheet();
  $sheet-&gt;setCellValue('A1', 'Hello World !');
  
  $writer = new Xlsx($spreadsheet);
  $writer-&gt;save('hello world.xlsx');
  </code></pre>
  
  <p>It shows how to create a excel file and save it on the server.
  How can I serve the result to the client instead and "force" him to download it?
  I need to get the data of the <code>$writer</code> somehow.</p>
  
  <p>I am currently solving it without PhpSpreadsheet:</p>
  
  <pre><code>// Excel Export 
      $filename = 'export_'.date('d-m-y').'.xls';
      $filename = $validator-&gt;removeWhitespace($filename);
  
      header('Content-type: application/ms-excel');
      header('Content-Disposition: attachment; filename='.$filename);
      exit($response["output"]);  // &lt;-- contains excel file content
  </code></pre>
  
  <p>But it is not working with my delimiter (semicolon). The semicolon is not getting interpreted and everything is getting written into one column.</p>
  
  <p><a href="https://i.stack.imgur.com/KgrX4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KgrX4.png" alt="enter image description here"></a></p>
  
  <p>If I export it as .csv, then it works. But I need it as .xls or .xlsx</p>