-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fatal error in charts using comma-separated cell references #316
Comments
I can confirm the bug with given code. As a workaround |
@PowerKiKi Thanks for the workaround. Can confirm that works in our use case. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@oleibman: sorry for dragging up this old issue (happy to raise a new one) but I wanted to ask whether there was any merit in addressing this yet to be resolved problem which I stumbled across today. I realise there is a workaround but I wondered whether you knew what was preventing PHPSpreadsheet from supporting comma-separated cell references as described above? |
The issue is in the Calculation Engine itself, and in how it handles values inside braces when not in the context of a function call, or an arithmetic expression. I've looked at how it can be addressed a couple of times now, but haven't yet come up with a satisfactory answer that doesn't break other working expressions |
This is:
What is the expected behavior?
Create an XLSX file with a chart that uses a comma-separated list of cell references for its series data and/or axis labels, e.g.
=(Worksheet!$B$2,Worksheet!$B$5)
This format is generated in Excel 2007 when Ctrl+clicking to select non-contiguous cells to be used for chart data or labels, as seen here:
What is the current behavior?
Program crashes:
PHP Fatal error: Uncaught exception 'PhpOffice\PhpSpreadsheet\Calculation\Exception' with message 'Formula Error: Unexpected ,' in /vagrant/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php:4078
Speculation: PhpSpreadsheet appears to be interpreting the cell reference list as a function call (comma-separated list within parentheses) missing the function name.
See sample code below; problem line is:
new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, '(Worksheet!$B$2,Worksheet!$B$5)', null, 4),
Sample code is based on the 33_Chart_create_bar example. Error also occurs with naturally generated XLSX files using the built-in Excel chart builder.
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:
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet dev-master (27d83b4), PHP 5.6
The text was updated successfully, but these errors were encountered: