Skip to content

Issue with condtional formatting with PHPspreadsheet #2678

Open
@pbabugn

Description

@pbabugn

This is:

- [ ] 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?

I have a template excel, where I have some headers, formulas and conditional styles. I am writing data to the cells and styles are applying.

I have condition on row 8 in column A as greater than $M$8 then apply some format.
So my condition should change for 9th row column A like $M$9 , for 10 th row $M10 and so on.
If I insert new row before 8th row 8th row will become 9th row and the condition will get change to $M$9.

What is the current behavior?

But my condition is still same (like $M$8 for 9,10,11.... rows) through phpspreadsheet.

What are the steps to reproduce?

  1. create a template excel and put one conditional format for any column based the row (like cell val > $M$8)
  2. insert new row before 8th row (using insertNewRowBefore founction)
  3. save template to another excel and see the 9th row condtional format (still $M$8), but if I insert manual then the condition is changing to ($M$rowno)

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

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

// add code that show the issue here...

Which versions of PhpSpreadsheet and PHP are affected?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions