-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
This is:
- [X] 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?
Expecting a worksheet to be fully duplicated using this code
$clonedWorksheet = clone $spreadsheet->getSheetByName('Worksheet 1');
$clonedWorksheet->setTitle('Copy of Worksheet 1');
$spreadsheet->addSheet($clonedWorksheet);
What is the current behavior?
Some cell styles like fills and font colors are not copied over
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:
<?php
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadsheet = $reader->load('Elevation.xlsx');
$new_elevation = clone $spreadsheet->getActiveSheet();
$new_elevation->setTitle('Max Potential');
$spreadsheet->addSheet($new_elevation);
$spreadsheet->setActiveSheetIndexByName('Max Potential');
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->save('php://output');Which versions of PhpSpreadsheet and PHP are affected?
1.21
Elevation.xlsx
cluis13915
Metadata
Metadata
Assignees
Labels
No labels