php 怎么把html页面生成word文档直接下载到本地

时间:2022-11-12 23:33:06
     
                              <p class="MsoNormal" align="center" style="text-align:center;mso-layout-grid-align:
none;text-autospace:none"><b><span style="font-size:22.0pt;font-family:宋体;
mso-hansi-font-family:&quot;Times New Roman&quot;;mso-font-kerning:0pt">公司员工试用合同<span lang="EN-US"><o:p></o:p></span></span></b></p>

<p class="MsoNormal" align="right" style="text-align:right;mso-layout-grid-align:
none;text-autospace:none"><br></p>

<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="mso-cellspacing:0cm;margin-left:.75pt;mso-table-layout-alt:fixed;
 mso-padding-alt:0cm 0cm 0cm 0cm">
 <tbody><tr>
  <td width="138" valign="top" style="width: 103.5pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; padding: 0cm;">
  <p class="MsoNormal" align="right" style="text-align:right;line-height:150%;
  mso-layout-grid-align:none;text-autospace:none"><span lang="EN-US" style="font-size:14.0pt;line-height:150%;font-family:宋体;mso-hansi-font-family:
  &quot;Times New Roman&quot;;mso-font-kerning:0pt">&nbsp;&nbsp;&nbsp;
  </span><span style="font-size:14.0pt;line-height:150%;font-family:
  宋体;mso-hansi-font-family:&quot;Times New Roman&quot;;mso-font-kerning:0pt">甲方:<span lang="EN-US"><o:p></o:p></span></span></p>
  </td>
  <td width="530" valign="top" style="width: 397.5pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; padding: 0cm;">     



得到的数据是 一串html代码。怎么把格式的转换成word文档并下载到本地,在线求解!!!! 可以联系 QQ 354032267 谢谢各位大侠 大神了 。。php 怎么把html页面生成word文档直接下载到本地

1 个解决方案

#1


必须是world吗?我这有个下载成TXT格式的代码,希望能帮到你
$id=$_GET['product_id'];
$getitem=getitemdetailfrompayment($id);
$filename='itemInfo.txt';//要导出的文件的文件名需要加上文件后缀

header('Content-Type: text/x-sql');

header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Content-Disposition: attachment; filename="' .$filename. '"');

$is_ie = 'IE';

   if ($is_ie == 'IE') {

       header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

       header('Pragma: public');

} else {

       header('Pragma: no-cache');

       header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

   }

echo “”HHHHHHH“”
exit();

#1


必须是world吗?我这有个下载成TXT格式的代码,希望能帮到你
$id=$_GET['product_id'];
$getitem=getitemdetailfrompayment($id);
$filename='itemInfo.txt';//要导出的文件的文件名需要加上文件后缀

header('Content-Type: text/x-sql');

header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');

header('Content-Disposition: attachment; filename="' .$filename. '"');

$is_ie = 'IE';

   if ($is_ie == 'IE') {

       header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

       header('Pragma: public');

} else {

       header('Pragma: no-cache');

       header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

   }

echo “”HHHHHHH“”
exit();