Skip to content

When load in PhpSpreadsheet for cleared cell in Excel, applied from entire row style #3533

Closed
@ngyuki

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?

Row style are not applied to cleared cell in Excel.

What is the current behavior?

Row style are applied to cleared cell in Excel.

What are the steps to reproduce?

  1. Apply background color to entire Row 1:1 in Excel
  2. Clear cell A1 in Excel (the background color of A1 is also cleared)
  3. Load and save the xlsx file with the following code
  4. In the saved xlsx file, the background color of A1 reverts back to before it was cleared
<?php

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

use PhpOffice\PhpSpreadsheet\IOFactory;
$book = IOFactory::load(__DIR__ . '/input.xlsx');
IOFactory::createWriter($book, IOFactory::READER_XLSX)->save(__DIR__ . '/output.xlsx');

input.xlsx
output.xlsx

What features do you think are causing the issue

  • 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?

XLSX (as far as I know)

Which versions of PhpSpreadsheet and PHP are affected?

php 8.2.2
phpoffice/phpspreadsheet 1.28.0 and master(e9cf273)

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