title: Customise the filename in phpword
body: <p>Is it possible to customize the filename in phpword when I want to download it?</p>
  <p>I want that the file takes the <code>prenoms</code> of the exported row.</p>
  <p>My code:</p>
  <pre><code>public function edit (Stagiaire $stagiaire)
    {
      $id = $stagiaire -&gt;id;
      $desc1 = Stagiaire::find($id);
      $my_template = new \PhpOffice\PhpWord\TemplateProcessor(public_path('templateStagiaire.docx'));
      $my_template-&gt;setValue('id, $desc-&gt;id);
      $my_template-&gt;setValue('prenoms, $desc-&gt;prenoms);
      $my_template-&gt;setValue('nom, $desc-&gt;nom);
  
      $filename = $stagiaire-&gt;prenoms;
      try{
         $my_template-&gt;saveAs(storage_path('templateStagiaire.docx'));
         }catch (Réception $e){}
       return response()-&gt;download(storage_path('&quot;.$filename.&quot;.docx));
  
       }
  </code></pre>
  <p>Need help.
  Thanks in advance.</p>