我在Laravel项目中工作。我的功能是基于表单数据生成docx文件。我将PhpOffice \ PhpWord软件包用于此功能。我需要从另一个docx文件插入内容。
我的PHP
代码:
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addText('Name: '.$user->name);
$section->addText('Email: '.$user->email);
$section->addText('Telefon: '.$user->tel);
// here I need to insert the content
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
try {
$objWriter->save(storage_path('app/'.$document->id.'.docx'));
}
catch (Exception $e) {
}
有人知道如何将docx内容插入另一个吗?