Skip to content

Error opening template xlsx with charts using cell reference chartTitles #2965

Open
@rolinger

Description

@rolinger

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?

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: #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:

<?php

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

// Open existing template file
$mainTempName = "$baseDir/reports/MainReportTemplate.xlsx" ;
$mainTempReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx") ;
$mainTempFile = $mainTempReader->load($mainTempName, \PhpOffice\PhpSpreadsheet\Reader\IReader::LOAD_WITH_CHARTS) ;

// just opening the template file causes the warning/error, and then all saved files are missing chartTitles.

What features do you think are causing the issue

  • Reader
  • Writer
  • Styles
  • Data Validations
  • Formula Calculations
  • [x ] Charts
  • AutoFilter
  • Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

Don't know, only testing with opening xlsx files

Which versions of PhpSpreadsheet and PHP are affected?

phpspreadsheet: 1.24.1
php: 7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions