这是我的Excel工作表代码:
$setRec = db_query($sql);
$columnHeader = '';
$columnHeader = "Employee Id" . "\t" . "Task Name" . "\t" . "Username" . "\t" . "Status Remark" . "\t". "Sequence" . "\t". "Shot No". "\t". "Image Type". "\t". "Image" . "\t". "Start Frame" . "\t". "End Frame" . "\t". "Mandays";
$setData = '';
while ($rec = db_fetch_array($setRec)) {
$rowData = '';
foreach ($rec as $value) {
$value = '"' . $value . '"' . "\t";
$rowData .= $value;
}
$setData .= trim($rowData) . "\n";
}
header("Content-type: application/octet-stream/image/png");
header("Content-Disposition: attachment; filename=exceltask.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo ucwords($columnHeader) . "\n" . $setData . "\n";
exit();
我能够导出所有数据,但是我需要直接在Excel工作表中使用Blob图片。
您可以简单地使用base64 encode
,例如:
echo '<img src="data:image/jpeg;base64,'.base64_encode( $result['image'] ).'"/>';
//这是您的项目的示例更改。