无法在表格中添加边框样式(phpword)

无法在表格中添加边框样式(phpword),php,css,phpword,Php,Css,Phpword,我试图在html中的表中添加边框。下面是我的代码 $phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->addSection(); $html = "<table border='1'> <tr> <th>name</th> </tr> <tr><td>John</td></tr> </table&g

我试图在html中的表中添加边框。下面是我的代码

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$html = "<table border='1'>
<tr>
<th>name</th>
</tr>
<tr><td>John</td></tr>
</table>";
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html );
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;filename="test.docx"');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('php://output');
$phpWord=new\phpooffice\phpWord\phpWord();
$section=$phpWord->addSection();
$html=”
名称
约翰
";
\PhpOffice\PhpWord\Shared\Html::addHtml($section,$Html);
标题(“内容类型:应用程序/八位字节流”);
标题('Content-Disposition:attachment;filename=“test.docx”');
$objWriter=\PhpOffice\PhpWord\IOFactory::createWriter($PhpWord,'Word2007');
$objWriter->save('php://output');
我分配了1的边界,但它不起作用。我的桌子上没有边框


通过添加样式,it事件不起作用。请帮助

尝试以最小的更改和所有工作运行代码)
require_once __DIR__ . '/vendor/autoload.php';

use PhpOffice\PhpWord\IOFactory;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\Html;

$phpWord = new PhpWord();
$section = $phpWord->addSection();
$html = "<table border='1'>
<tr>
<th>name</th>
</tr>
<tr><td>John</td></tr>
</table>";
Html::addHtml($section, $html);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;filename="test.docx"');
$objWriter = IOFactory::createWriter($phpWord);
$objWriter->save('php://output');
require\u once\uuuuu DIR\uuuuuuu.'/供应商/autoload.php';
使用PhpOffice\PhpWord\IOFactory;
使用PhpOffice\PhpWord\PhpWord;
使用PhpOffice\PhpWord\Shared\Html;
$phpWord=新phpWord();
$section=$phpWord->addSection();
$html=”
名称
约翰
";
Html::addHtml($section,$Html);
标题(“内容类型:应用程序/八位字节流”);
标题('Content-Disposition:attachment;filename=“test.docx”');
$objWriter=IOFactory::createWriter($phpWord);
$objWriter->save('php://output');

尝试以最小的更改和所有工作运行代码)
require_once __DIR__ . '/vendor/autoload.php';

use PhpOffice\PhpWord\IOFactory;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Shared\Html;

$phpWord = new PhpWord();
$section = $phpWord->addSection();
$html = "<table border='1'>
<tr>
<th>name</th>
</tr>
<tr><td>John</td></tr>
</table>";
Html::addHtml($section, $html);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment;filename="test.docx"');
$objWriter = IOFactory::createWriter($phpWord);
$objWriter->save('php://output');
require\u once\uuuuu DIR\uuuuuuu.'/供应商/autoload.php';
使用PhpOffice\PhpWord\IOFactory;
使用PhpOffice\PhpWord\PhpWord;
使用PhpOffice\PhpWord\Shared\Html;
$phpWord=新phpWord();
$section=$phpWord->addSection();
$html=”
名称
约翰
";
Html::addHtml($section,$Html);
标题(“内容类型:应用程序/八位字节流”);
标题('Content-Disposition:attachment;filename=“test.docx”');
$objWriter=IOFactory::createWriter($phpWord);
$objWriter->save('php://output');