PHP HTML到DOC

时间:2015-06-09 19:34:49

标签: php html converter doc

我正在使用以下内容将html文件转换为doc。

以下示例效果很好,它确实应该做到了,但我有另一个文档,但在本文档中我主要使用<div>而不是表。 使用fooling时,似乎转换或单词的div无效。

我是对的吗?文档的内容是通过,但布局和样式完全被打成碎片。

div doc作为普通的html文件运行看起来很完美。

请任何想法。

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: vnd.ms-word");
header("Content-Disposition: attachment; filename='DischargeLetter.doc'");
header("Content-Transfer-Encoding: binary ");

$text = "$text="<style type='text/css'>
.tg  {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-uhkr{background-color:#ffce93}
.tg .tg-wsnc{background-color:#fffc9e}
.tg .tg-glis{font-size:10px}
.tg .tg-7khl{font-size:15px}
.tg .tg-3sk9{font-weight:bold;font-size:12px}
.tg .tg-jzyw{font-weight:bold;font-size:13px}
</style>
<table class='tg'>
  <tr>
    <th class='tg-uhkr' colspan='3'>Logo<br>thaaf<br>la;sdkhf;ls<br>a;slkdhals</th>
    <th class='tg-uhkr' colspan='3''>Address</th>
  </tr>
  <tr>
    <td class='tg-3sk9'>1st Col</td>
    <td class='tg-glis'>2nd col</td>
    <td class='tg-glis'>3rd col</td>
    <td class='tg-jzyw'>4th col</td>
    <td class='tg-glis'>5th col</td>
    <td class='tg-glis'>6th col</td>
  </tr>
  <tr>
    <td class='tg-wsnc' colspan='6'>Row</td>
  </tr>
  <tr>
    <td class='tg-7khl' colspan='2'>1 of 3</td>
    <td class='tg-031e' colspan='2'>2 of 3</td>
    <td class='tg-031e' colspan='2'>3 of 3</td>
  </tr>
</table>";




echo $text;

0 个答案:

没有答案