Skip to content

"!" characters in Worksheet title will make reference formulas crash #325

@hampusiggstrom

Description

@hampusiggstrom

This is:

- [X] a bug report
- [ ] a feature request
- [X] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

The calculation should be valid. The "!" needs to be added to $invalidCharacters or calculations needs to be updated to support exclamation mark characters in sheet titles.

What is the current behavior?

Uncaught PhpOffice\PhpSpreadsheet\Calculation\Exception: Title!!C1 -> Cell coordinate can not be zero-length string

What are the steps to reproduce?

<?php

require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('Title!');
$sheet->fromArray([1, 2,'=SUM(A1:A2)']);

$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');

Which versions of PhpSpreadsheet and PHP are affected?

all

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions