$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$table = $section->addTable();
$i = 1;
$document = $PHPWord->loadTemplate('/var/sitLims/web/uploads/lmsSyllabus/lmsSyllabus.docx');
$document->setValue('Value1', $course_number);
$document->setValue('Value2', $course_name);
$document->setValue('Value3', $course_en_name);
$document->setValue('Value4', $course_summary);
$document->setValue('Value5', $course_purposes);
$document->setValue('Value6', $course_content);
$document->setValue('Value7', $course_exam);
$document->setValue('Value8', $course_description);
$document->setValue('Value9', $syllabus_person);
$document->setValue('Value10', $syllabus_academy_opinion);
foreach($syllabus_experiment as $a) {
$table->addRow();
$table->addCell(30)->addText($i);
$table->addCell(118)->addText($a->lmsExperiment->getExperimentName());
$table->addCell(118)->addText('');
$table->addCell(50)->addText($a->lmsExperiment->getExperimentExperimental());
$table->addCell(50)->addText($a->lmsExperiment->getThisExperimentHours());
$table->addCell(50)->addText($a->lmsExperiment->getExperimentEachNumber());
$table->addCell(50)->addText($a->lmsExperiment->getExperimentLab());
$table->addCell(50)->addText($a->lmsExperiment->getExperimentProjectArrange());
$i ++;
}
$document->save('/var/sitLims/web/uploads/lmsSyllabus/' . $syllabus_name . '.docx');`
创建word文件时我不确定如何插入表格我应该在模板中的任何地方插入表格吗?