admin管理员组文章数量:1344241
I'm having trouble converting an Excel file to a PDF. The PDF file is created, but nothing is in it.
Here's my code.
<?php
require_once '../../excel/vendor/autoload.php';
require_once "../conexion.php";
use PhpOffice\PhpSpreadsheet\IOFactory;
$obj = new Conexion();
$conexion = $obj -> conectar();
$sql="SELECT * FROM servicios WHERE id='6'";
$result=mysqli_query($conexion,$sql);
$mostrar = mysqli_fetch_row($result);
$filename = '../../documento/OT.xlsx';
$spreadsheet = IOFactory::load($filename);
$worksheet = $spreadsheet->getActiveSheet();
$worksheet->mergeCells('C4:E4')->setCellValue("C4","Presupuesto No. ".$mostrar[0]);
$worksheet->mergeCells('H11:I11')->setCellValue("H11",date('d/m/Y',strtotime($mostrar[1])));
$worksheet->mergeCells('H12:I12')->setCellValue("H12",$mostrar[2]);
$worksheet->mergeCells('H13:I13')->setCellValue("H13",$mostrar[3]);
$worksheet->mergeCells('E14:I14')->setCellValue("E14",$mostrar[4]);
$worksheet->mergeCells('C15:I15')->setCellValue("C15",'Atención : '.$mostrar[5]);
$worksheet->setCellValue("I19",$mostrar[7]);
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf');
$writer->save("05featuredemo.pdf");
?>
本文标签: phpConvert Excel file to PDF with PhpspreadsheetStack Overflow
版权声明:本文标题:php - Convert Excel file to PDF with Phpspreadsheet - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743736626a2530128.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论