使用phpword和;html到docx转换器

使用phpword和;html到docx转换器,php,html,css,phpword,Php,Html,Css,Phpword,我正在努力创建一个没有边框的表格,并给出一个只有td边框的底部,没有任何乐趣。我正在使用html-to-docx转换与phpword结合使用。我尝试过内联样式或使用“style.inc”文件,但没有成功: 斯泰尔公司 "table" => array( // Note that applying a table style in PHPWord applies the relevant style to

我正在努力创建一个没有边框的表格,并给出一个只有td边框的底部,没有任何乐趣。我正在使用html-to-docx转换与phpword结合使用。我尝试过内联样式或使用“style.inc”文件,但没有成功:

斯泰尔公司

"table" => array(
                        // Note that applying a table style in PHPWord applies the relevant style to
                        // ALL the cells in the table. So, for example, the borderSize applied here
                        // applies to all the cells, and not just to the outer edges of the table:
                        "size" => 11,
                        "border" => 0,
                        "width" => "100%",
                        "borderSize" => 0,
                        "lineHeight" => 20,
                    )
HTML:

$html.='';
$html.='';
$html.='header1';
$html.='';
$html.='';
$html.='站点地址';
$html.=‘单位数量’;
$html.='Value';
$html.='以平方米为单位的大小';
$html.='';
$html.='';
$html.='Sample Text';
$html.='Sample Text';
$html.='Sample Text';
$html.='Sample Text';
$html.='';
$html.='';
$html.='专业联系方式:';
$html.='';
$html.='';
$html.='Company';
$html.=“地址”;
$html.=“联系人”;
$html.='Contact';
$html.='';
$html.='';

您使用的是哪个版本的PhpWord?可能是一些旧版本,因为新版本不需要单独的html到docx转换器。。。至少在新版本中,如果不需要将表结构定义为html(即,如果可以使用phpword表元素),那么这很容易实现。phpword的当前html类非常有限。我做了一些改进,看。通过编辑parseStyle方法,可以轻松添加边框样式。
                $html .= '<table border="0" style="border: 0 none;">';
                $html .= '  <tr>';
                $html .= '      <td colspan="4"><h2>Header 1</h2></td>';
                $html .= '  </tr>';
                $html .= '  <tr>';
                $html .= '      <th style="border: 0 none; border-bottom: 1px solid #000000;"><b>Site Address</b></th>';
                $html .= '      <th style="border: 0 none; border-bottom: 1px solid #000000;"><b>No. of Units</b></th>';
                $html .= '      <th style="border: 0 none; border-bottom: 1px solid #000000;"><b>Value</b></th>';
                $html .= '      <th style="border: 0 none; border-bottom: 1px solid #000000;"><b>Size in m<sup>2</sup></b></th>';
                $html .= '  </tr>';
                $html .= '  <tr>';
                $html .= '      <td style="vertical-align: middle" width="300">Sample Text</td>';
                $html .= '      <td style="vertical-align: middle" width="300">Sample Text</td>';
                $html .= '      <td style="vertical-align: middle" width="300">Sample Text</th>';
                $html .= '      <td style="vertical-align: middle" width="300">Sample Text</td>';
                $html .= '  </tr>';
                $html .= '  <tr>';
                $html .= '      <td colspan="4"><h2>Professional Contact Details:</h2></td>';
                $html .= '  </tr>';
                $html .= '  <tr>';
                $html .= '      <th width="300"><b>Company</b></th>';
                $html .= '      <th width="300"><b>Address</b></th>';
                $html .= '      <th width="300"><b>Contact Person</b></th>';
                $html .= '      <th width="300"><b>Contact</b></th>';
                $html .= '  </tr>';
                $html .= '</table>';