Files
oleibman 14a989a7e3 Handle Missing Defined Names Better
The original issue leading to this PR was fixed by correctly treating a token in Calculator as a function rather than a defined name. However, it *should* have worked even when treating it as a defined name. There was a problem because Calculator was raising an exception for a missing defined name rather than returning `#NAME?`. It is now changed to return the error.

That change initially had some adverse affects for functions ROW, ROWS, COLUMN, and COLUMNS. Those are fixed to handle the change correctly. As a bonus, a test for each which had been commented out, because it didn't work, is now uncommented and works correctly. One test for ISFORMULA and one for ISREF were also changed - the old expected result did not reflect Excel's behavior and the new one does.

Sheet title and Defined Name matching used `strtoupper` to achieve case-insensitive compares. This handles only ASCII characters. They are changed to use a conversion routine which handles non-ASCII UTF-8 character sets.
2025-08-12 09:21:26 -07:00

22 lines
878 B
PHP

<?php
declare(strict_types=1);
return [
'global $E$2:$E$6' => [5, 'namedrangex'],
'global $F$2:$H$2' => [1, 'namedrangey'],
'global $F$4:$H$4' => [1, 'namedrange3'],
'local in scope $F$5:$H$5' => [1, 'namedrange5'],
'local out of scope' => ['#NAME?', 'localname'],
'non-existent sheet' => [5, 'UnknownSheet!B2:K6'],
'not enough arguments' => ['exception', 'omitted'],
'other existing sheet' => [6, 'OtherSheet!A1:H6'],
'qualified in scope $F$5:$H$5' => [1, 'ThisSheet!namedrange5'],
'single cell absolute' => [1, '$C$7'],
'single cell relative' => [1, 'C7'],
'unknown name' => ['#NAME?', 'InvalidCellAddress'],
'unknown name as first part of range' => ['#NAME?', 'Invalid:A2'],
'unknown name as second part of range' => ['#NAME?', 'A2:Invalid'],
'qualified out of scope $F$6:$H$6' => [1, 'OtherSheet!localname'],
];