1

I can only see the texts in my word document while the image is just a box with X.

<?php
header("Content-type: application/msword");
header("Content-Disposition: attachment;Filename=test.doc");
?>
<html>
  <head></head>
  <body>
    <img src="http://mydomainname/Gallery/header.png" width="600px" height="110px" style="opacity:0.5;">
  </body>
</html>
huysentruitw
  • 27,376
  • 9
  • 90
  • 133
안젤라
  • 43
  • 1
  • 7
  • this seems to be a hard one i been googling up for days but still cant find a way and as of today no one has answer to this question yet – 안젤라 Dec 30 '15 at 07:16
  • Possible duplicate of [How to display images in Word generated from HTML?](http://stackoverflow.com/questions/2329897/how-to-display-images-in-word-generated-from-html) – huysentruitw Dec 30 '15 at 09:08

2 Answers2

2

Have you checked libraries for working with MS Word like PHPWord? According to its example you can save HTML as Word file.

max
  • 2,757
  • 22
  • 19
0

Try it:

   $nama_file='name_file.doc';
   header("Content-Type: application/vnd.ms-word");
   header("Expires: 0");
   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
   header("Content-disposition: attachment; filename=".$nama_file);
   header("Pragma: public");
Panagiotis Koursaris
  • 3,794
  • 4
  • 23
  • 46
id25
  • 1