-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
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)
Summary
XLSX files (at the very least) support sheet titles over 31 characters, but PhpSpreadsheet enforces a 31-character limit regardless of file format. This would be annoying if it only affected sheet creation, but the validation code is also run on load. This means that PhpSpreadsheet is unable to load any valid XLSX file (or file of any other format) containing a sheet with a name over 32 characters.
What is the expected behavior?
A worksheet title containing 32 characters is set correctly. An exception should only be thrown when saving to a format that doesn't support longer titles.
What is the current behavior?
An exception is thrown with the message "Maximum 31 characters allowed in sheet code name.".
What are the steps to reproduce?
(Shows creating a new file, but the same behaviour is encountered when loading an existing file with a sheet title over 31 chars.)
<?php
require __DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$sheet = $spreadsheet->getSheet();
$sheet->setTitle('ten chars ten chars ten chars +2');Which versions of PhpSpreadsheet and PHP are affected?
PHPExcel 1.8, PhpSpreadsheet develop