-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
Which versions of PhpSpreadsheet and PHP are affected?
1.28 \ 7.4
hello, how can i save the pdf file ? I use your code but it doesn't work for some reason
<?php
require "../../vendor/config.php";
require "../../vendor/autoload.php";
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$counter = 0;
$helper->log('Populate spreadsheet');
for ($row = 1; $row < 501; ++$row) {
$sheet->getCell("A$row")->setValue(++$counter);
// Add many styles by using slight variations of font color for each.
$sheet->getCell("A$row")->getStyle()->getFont()->getColor()->setRgb(sprintf('%06x', $counter));
$sheet->getCell("B$row")->setValue(++$counter);
$sheet->getCell("C$row")->setValue(++$counter);
}
$helper->log('Write to Mpdf');
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class);
$helper->write($spreadsheet, __FILE__, ['Pdf']);
$spreadsheet->disconnectWorksheets();
I looked at examples like this samples
I looked through the files from the first to the sixth, but did not understand how to save the data in pdf
Metadata
Metadata
Assignees
Labels
No labels