php - Exported word doc gets saved as htm -


i'm using html_to_doc export html .doc format works fine. problem i'm having when open document , go save as default document type .htm / .html.

i'm using linux , i'd keep using class if possible. these set headers in php:

@header("cache-control: ");// leave blank avoid ie errors @header("pragma: ");// leave blank avoid ie errors @header("content-type: application/octet-stream"); @header("content-disposition: attachment; filename=\"$this->docfile\""); 

and doc header (without style):

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/tr/rec-html40">  <head> <meta http-equiv=content-type content="text/html; charset=utf-8"> <meta name=progid content=word.document> <meta name=generator content="microsoft word 9"> <meta name=originator content="microsoft word 9"> <!--[if !mso]> <style> v\:* {behavior:url(#default#vml);} o\:* {behavior:url(#default#vml);} w\:* {behavior:url(#default#vml);} .shape {behavior:url(#default#vml);} </style> <![endif]--> <title>$this->title</title> <!--[if gte mso 9]><xml> <w:worddocument> <w:view>print</w:view> <w:donothyphenatecaps/> <w:punctuationkerning/> <w:drawinggridhorizontalspacing>9.35 pt</w:drawinggridhorizontalspacing> <w:drawinggridverticalspacing>9.35 pt</w:drawinggridverticalspacing> </w:worddocument> </xml><![endif]--> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1032"> <o:colormenu v:ext="edit" strokecolor="none"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> $this->htmlhead </head> 

try using header

header("content-type: application/vnd.ms-word"); 

and make sure filename has .doc/ or .docx extension


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

html - Repeat image to extend header to fill screen -

javascript - Backbone.js getting target attribute -