Skip to content

removeRow with merged Cells apply the same merging to the row below #4077

Closed
@VoigtK

Description

@VoigtK

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.

Screenshot 2024-06-27 at 10 23 01

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');

test.xlsx

What features do you think are causing the issue

  • Reader
  • 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"
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions