Ms word PhpWord:加载模板并另存为Word文档将删除表格/单元格边框

Ms word PhpWord:加载模板并另存为Word文档将删除表格/单元格边框,ms-word,phpword,phpoffice,word-template,Ms Word,Phpword,Phpoffice,Word Template,如果我加载一个模板,甚至是一个直接的文档作为模板,除了保存它什么都不做,它会删除表格/单元格边框 这是我的密码: $this->word = new PhpWord\PhpWord; $this->template = $this->word->loadTemplate('path/to/template.dotx'); // this could be a .docx - same results $templatefilepath = $this->templa

如果我加载一个模板,甚至是一个直接的文档作为模板,除了保存它什么都不做,它会删除表格/单元格边框

这是我的密码:

$this->word = new PhpWord\PhpWord;
$this->template = $this->word->loadTemplate('path/to/template.dotx'); // this could be a .docx - same results
$templatefilepath = $this->template->save();
$word = \PhpOffice\PhpWord\IOFactory::load($templatefilepath);
$writer = PhpWord\IOFactory::createWriter($word, 'Word2007');
$writer->save('/path/to/worddoc.docx');

// Output all necessary headers...

echo File::get('/path/to/worddoc.docx'); // (Lumen)
这会将模板另存为Word文档,但会去掉所有表/单元格边框