PhpSpreadsheet
PhpSpreadsheet copied to clipboard
removeRow with merged Cells apply the same merging to the row below
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?
removing a row where cells in the row are merged should not merge the cells in the row below
What is the current behavior?
I have a simple file where Row 1 Cells 1 to 4 are merged (Gray highlighted) When removing this row, the Row 2, now Row 1 has its Cells 1 to 4 merged. Although they were not merged before.
What are the steps to reproduce?
<?php
require __DIR__ . '/vendor/autoload.php';
// Load file
$reader = IOFactory::createReader(IOFactory::READER_XLSX);
$spreadsheet = $reader->load($file);
// Remove row
$spreadsheet->getActiveSheet()->removeRow(1);
// Save file
$writer = IOFactory::createWriter($spreadsheet, IOFactory::WRITER_XLSX);
$writer->save(substr($file, 0, -5) . '_edited.xlsx');
What features do you think are causing the issue
- [ ] Reader
- [X] Writer
- [ ] Styles
- [ ] Data Validations
- [ ] Formula Calculations
- [ ] Charts
- [ ] AutoFilter
- [ ] Form Elements
Which versions of PhpSpreadsheet and PHP are affected?
PHP 8.3.8 (cli) (built: Jun 4 2024 14:53:17) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.8, Copyright (c) Zend Technologies
"name": "phpoffice/phpspreadsheet",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "dbed77bd3a0f68f96c0dd68ad4499d5674fecc3e"
},
Confirmed. I was hoping PR #3528 might address this, but it doesn't.
This appears to have been fixed by PR #4465 which was merged this week.