peterrehm
Repos
13
Followers
16
Following
15

The Symfony PHP framework

27475
8585

Twig, the flexible, fast, and secure template language for PHP

7612
1126

Provide custom vagrant boxes to speedup setup of Symfony/PHP dev environments

2
1

Git/GitHub toolkit

0
3

Events

Unmerge cells removes content

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?

When unmerging cells in Excel, the content of the cells is preserved. Attached is the original file where I have merged cells and the content is not in the main cell. Unmerging it shows the colored cells and the content when using excel.

What is the current behavior?

The background color is preserved, not the content.

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

require __DIR__ . '/vendor/autoload.php';

        $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($fileName);

        $sheetNames = $spreadsheet->getSheetNames();

        foreach ($sheetNames as $sheetName) {
            foreach ($worksheet->getMergeCells() as $cells) {
                $worksheet->unmergeCells($cells);
            }
        }

        $writer = new Xlsx($spreadsheet);
        $writer->save(__DIR__ . '/../../file_output.xlsx');

If this is an issue with reading a specific spreadsheet file, then it may be appropriate to provide a sample file that demonstrates the problem; but please keep it as small as possible, and sanitize any confidential information before uploading.

What features do you think are causing the issue

- [X] Reader
- [ ] Writer
- [ ] Styles
- [ ] Data Validations
- [ ] Formula Calculations
- [ ] Charts
- [ ] AutoFilter
- [ ] Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

file_original.xlsx file_output_unmerged_phpspreadsheet.xlsx file_unmerged_excel.xlsx Unmerg

Which versions of PhpSpreadsheet and PHP are affected?

PHP 8.1 and phpspreadsheet 1.24.1

Created at 2 weeks ago
issue comment
Unmerge cells removes content

Thanks, it works like a charm. You have provided provided an amazing support :smiling_face_with_three_hearts:

Created at 2 weeks ago
issue comment
Unmerge cells removes content

Thanks for the great analysis - would be awesome if you could find any solution. Let me know if I can help.

Created at 2 weeks ago
issue comment
Unmerge cells removes content

Thanks for the very fast response. I got that through an Excel Export of an application.

Created at 2 weeks ago
Unmerge cells removes content

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?

When unmerging cells in Excel, the content of the cells is preserved. Attached is the original file where I have merged cells and the content is not in the main cell. Unmerging it shows the colored cells and the content when using excel.

What is the current behavior?

The background color is preserved, not the content.

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

require __DIR__ . '/vendor/autoload.php';

        $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($fileName);

        $sheetNames = $spreadsheet->getSheetNames();

        foreach ($sheetNames as $sheetName) {
            foreach ($worksheet->getMergeCells() as $cells) {
                $worksheet->unmergeCells($cells);
            }
        }

        $writer = new Xlsx($spreadsheet);
        $writer->save(__DIR__ . '/../../file_output.xlsx');

If this is an issue with reading a specific spreadsheet file, then it may be appropriate to provide a sample file that demonstrates the problem; but please keep it as small as possible, and sanitize any confidential information before uploading.

What features do you think are causing the issue

  • [X] Reader
  • [ ] Writer
  • [ ] Styles
  • [ ] Data Validations
  • [ ] Formula Calculations
  • [ ] Charts
  • [ ] AutoFilter
  • [ ] Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

file_original.xlsx file_output_unmerged_phpspreadsheet.xlsx file_unmerged_excel.xlsx Unmerg

Which versions of PhpSpreadsheet and PHP are affected?

PHP 8.1 and phpspreadsheet 1.24.1

Created at 2 weeks ago