当我在代码中添加图片时,它在我的办公室中显示空白图片。
$document_with_table = new \PhpOffice\PhpWord\PhpWord();
$section = $document_with_table->addSection();
$table = $section->addTable(array('align'=>'center'));
$table->addRow();
这是我的问题
$table->addCell(2000,$styleCell)->addImage('source_image.jpg');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($document_with_table, 'Word2007');
$fullxml = $objWriter->getWriterPart('Document')->write();
$tablexml = preg_replace('/^[\s\S]*(<w:tbl\b.*<\/w:tbl>).*/', '$1', $fullxml);
$template_document = new \PhpOffice\PhpWord\TemplateProcessor(base_url('my_template.docx'));
$template_document->setValue('table', $tablexml);