Open rolinger opened 2 years ago
I can confirm your reported behavior. It's easy to eliminate the error. I'm not sure how easy it is to get the behavior you want. At the moment, Title is expected to be a static property. I'm not sure of all that would be needed to make it dynamic. It seems a lot more complicated than you might think.
@oleibman To eliminate the error, I suppose the work around is removing the title from the chart? I can do it temporarily and simply add a centered cell above the chart that references the title cell on the data page....same effect but not as clean. Not certain how to categorize it. A template with a chart title referencing a cell causes an error (thus a bug), but at the same time its clear the Charts.php
base code does not support this (thus a feature request). And no, I don't imagine its easy to add.
This is:
What is the expected behavior?
Existing template chart titles refers to a cell values on a specific sheet. When importing the template I am expecting the chart titles to be recognized. Seems to be same issue as here: https://github.com/PHPOffice/PhpSpreadsheet/issues/749
What is the current behavior?
Upon opening the template file, getting warning/errors for every chart that has a title based on a cell reference:
PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart::chartTitle(): Node no longer exists in /home/myDir/php/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php on line 360
What are the steps to reproduce?
Create a template with two sheets, Sheet1 is raw data, Sheet2 are preformatted charts with each chartTitle referring to a specific cell on Sheet1.
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:
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Don't know, only testing with opening
xlsx
filesWhich versions of PhpSpreadsheet and PHP are affected?
phpspreadsheet: 1.24.1 php: 7.3