Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| DefaultExcel | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package Modules\Media |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter; |
| 16 | use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; |
| 17 | use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; |
| 18 | |
| 19 | class DefaultExcel extends \PhpOffice\PhpSpreadsheet\Spreadsheet |
| 20 | { |
| 21 | /** |
| 22 | * Constructor. |
| 23 | * |
| 24 | * @since 1.0.0 |
| 25 | */ |
| 26 | public function __construct() |
| 27 | { |
| 28 | parent::__construct(); |
| 29 | |
| 30 | $this->getActiveSheet() |
| 31 | ->getPageSetup() |
| 32 | ->setPaperSize(PageSetup::PAPERSIZE_A4); |
| 33 | |
| 34 | $this->getActiveSheet() |
| 35 | ->getHeaderFooter() |
| 36 | ->setOddHeader("&L&B&20Jingga\n&B&10Business solutions made simple."); |
| 37 | |
| 38 | $this->getActiveSheet() |
| 39 | ->getHeaderFooter() |
| 40 | ->setOddFooter('&RPage &P/&N'); |
| 41 | |
| 42 | /* |
| 43 | Tested with LibreOffice and not working (requires &G above in the text). |
| 44 | Either it is broken or LibreOffice cannot show the image. |
| 45 | $drawing = new HeaderFooterDrawing(); |
| 46 | $drawing->setName('PhpSpreadsheet logo'); |
| 47 | $drawing->setPath(__DIR__ . '/../Web/Backend/img/logo.png'); |
| 48 | $drawing->setHeight(50); |
| 49 | |
| 50 | $this->getActiveSheet() |
| 51 | ->getHeaderFooter() |
| 52 | ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT); |
| 53 | */ |
| 54 | } |
| 55 | } |