title: Generate ms word document using PhpWord
body: <p>I'm going to generate some document using PhpWord, I have some draft document where I set <code>client_name</code> dynamically.</p>
  
  <pre><code>$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($draftUrl);
  $templateProcessor-&gt;setValue("client_name", $clientName);
  
  $filename = '30.docx';
  $templateProcessor-&gt;saveAs($filename);
  </code></pre>
  
  <p>then I read this file and user can download it</p>
  
  <pre><code>header('Content-Type: application/octet-stream');
  header("Cache-Control: no-cache, must-revalidate");
  header("Pragma: no-cache");
  header("Content-Disposition: attachment; filename='$filename'");
  readfile($filename);
  </code></pre>
  
  <p>when I try to open it via <strong>MsOffice</strong> I have this message:
  <a href="https://i.stack.imgur.com/ISt62.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ISt62.png" alt="enter image description here"></a> </p>
  
  <p>when I click <strong><em>OK</em></strong>:
  <a href="https://i.stack.imgur.com/tfRdW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tfRdW.png" alt="enter image description here"></a></p>
  
  <p>and after accepting this finally I see my document ready. What do I need to generate readable document? </p>