'Footer works on xlsx exporting but not in Mpdf with Phpspreadsheet
Hi everyone and thanks in advance for your help.
I'm trying to set Footer to a pdf Phpsrpreadsheet generated file but, although it works when I export it in xlsx it doesn't work when I save it as a pdf (mpdf) file.
The code is something like:
$spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('SomeFooter');
I also tried:
$spreadsheet->getActiveSheet()->getPageMargins()->setBottom(1);
$spreadsheet->getActiveSheet()->getPageMargins()->setFooter(1);
Is there any solution or do I have to roughly create xslx and later convert it in pdf?
Thank you very much
Solution 1:[1]
No one answered. I solved with a function that:
- Finds the end of the page.
- creates a line at the end of each page.
- sets the height of that line
- reduces bottom margin of the same height (not exceeding minimum printable margins)
- Writes the footer
It's a rough workaround maybe, but that worked. Maybe someone knows a better way. Hope it helps for somebody
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |