我可以使用MS Excel手动嵌入文档(插入->对象->从文件创建)。请参考图片。
如何通过PHPExcel或任何其他PHP库实现此目标?
答案 0 :(得分:0)
首先,您应该使用phpspreadsheet,phpexcel已被替换。我在phpspreadsheet安装的子目录/templates/sampleSpreadsheet.php中找到了此代码。您可能会在phpexcel安装中找到它?
// Add a drawing to the worksheet
$helper->log('Add a drawing to the worksheet');
$drawing = new Drawing();
$drawing->setName('PhpSpreadsheet logo');
$drawing->setDescription('PhpSpreadsheet logo');
$drawing->setPath(__DIR__ . '/images/PhpSpreadsheet_logo.png');
$drawing->setHeight(36);
$drawing->setCoordinates('D24');
$drawing->setOffsetX(10);
$drawing->setWorksheet($spreadsheet->getActiveSheet());