【发布时间】:2020-05-13 11:50:38
【问题描述】:
我正在尝试使用 laravel 在 phpword 中绘制表格 下面的代码是在 doc 文件中编写内容的示例。
$wordTest = new \PhpOffice\PhpWord\PhpWord();
$newSection = $wordTest->addSection();
$desc1 = "The Portfolio details is a very useful feature of the web page. You can establish your archived details and the works to the entire web community. It was outlined to bring in extra clients, get you selected based on this details.";
$newSection->addText($desc1, array('name' => 'Tahoma', 'size' => 15, 'color' => 'red'));
$objectWriter = \PhpOffice\PhpWord\IOFactory::createWriter($wordTest, 'Word2007');
$objectWriter->save(storage_path('TestWordFile.docx'));
请举个例子说明我如何在那里画桌子
【问题讨论】:
-
尝试使用
addHTML函数并传递完整的HTML,reference -
但它的风格不起作用
-
style 对于此类文件写入无法正常工作,因为 word 无法理解 CSS。尝试使用内联 CSS,看看是否可行。