-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
This is:
- [ ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
What is the current behavior?
What are the steps to reproduce?
I have an .xlsx file created in microsoft excel. this has a backround image. I use this file as a template. All other formatting is preserved but the background image is not visible when I create the output file based on this template
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:
<?php
require __DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadsheet = $reader->load($inputFile);
$sheet = $spreadsheet->getSheetByName('MainSheet');
$sheet->setCellValue('a2', $excelTitle);
if ($userPic) { //try getting it again just in case settings changed later
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
$drawing->setPath($userPic); // put your path and image here
$drawing->setCoordinates('B2');
$drawing->setWidthAndHeight(280, 280);
$drawing->setOffsetX(28);
$drawing->setRotation(0);
$drawing->getShadow()->setVisible(true);
$drawing->getShadow()->setDirection(45);
$drawing->setWorksheet($spreadsheet->getActiveSheet());
}
$writer = new Xlsx($spreadsheet);
echo "\r\n\r\n writing to $outputFile line " . __LINE__ ;
$writer->save($outputFile);
// add code that show the issue here...Which versions of PhpSpreadsheet and PHP are affected?
1.14.1 - 2020-07-19
PHP Version 7.2.24
Metadata
Metadata
Assignees
Labels
No labels