Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getCell() no longer works with named cells #1858

Closed
beard7 opened this issue Feb 17, 2021 · 3 comments
Closed

getCell() no longer works with named cells #1858

beard7 opened this issue Feb 17, 2021 · 3 comments

Comments

@beard7
Copy link

beard7 commented Feb 17, 2021

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?

Accessing a named cell reference with getCell('CELLNAME', false) should return the cell object.

What is the current behavior?

Throws an exception: Cell coordinate must not be absolute.

It's no longer possible to access a named cell using getCell(), which means it's no longer possible to use PhpSpreadsheet as a 'template processor'.

This worked on previous versions. Is there a workaround or could a getNamedCell() method be added?

What are the steps to reproduce?

Use getCell() with a named cell.

Which versions of PhpSpreadsheet and PHP are affected?

1.15.0

@MarkBaker
Copy link
Member

The changes to named ranges in release 1.15.0 mean relative and absolute addresses in ranges are now handled correctly (as MS Excel handles them, rather than always treating them as absolute) in formulae (previously, this was not the case).

It seems that I overlooked the fact that getCell() also supports access to a named cell; and it wasn't simply Formulae that used them.

Expect a fix to master later today, and for the 1.17.0 release.

@beard7
Copy link
Author

beard7 commented Feb 19, 2021

@MarkBaker brilliant.

Thanks for the quick fix!

MarkBaker pushed a commit that referenced this issue Feb 19, 2021
MarkBaker pushed a commit that referenced this issue Feb 19, 2021
MarkBaker pushed a commit that referenced this issue Feb 19, 2021
…#1866)

* Apply stricter scoping rules to named range/cell access via Worksheet object
* Additional unit tests
@MarkBaker
Copy link
Member

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants