-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
This is:
- [X] a bug report
- [ ] a feature request
- [X] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
I expect that after writing a template with an image in the first header, said image is still visible after saving the template.
What is the current behavior?
When loading a template with an image in the first Header the image is not visible after writing the template.
I do not edit the headers in any way, also the image is still available during editing, which I checked with:
$sheet->getHeaderFooter()
Which generates output like:
...'headerFooterImages' => array ( 'RFFIRST' => PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing::__set_state(array( 'path' => 'zip:///tmp/xlsxjQgpOD#xl/media/image1.jpeg', 'imageIndex' => 1,...
What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
I know my example does not fully comply with these guidelines, but a template can easily be created by creating an Excelfile and add a JPG-Image to the first Header.
<?php
require __DIR__ . '/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
$spreadsheet = IOFactory::load("Path/To/Template/With/ImageHeader");
//Image should still be visible under 'RFFIRST'
var_dump($spreadsheet->getActiveSheet()->getHeaderFooter());
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
//Image gets lost
$writer->save("SpreadsheetWithNoHeader.xlsx");
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet: 1.8.2
PHP: 7.0.33
This issue is related to #484 which was marked as stale and never got solved.