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
873 B
PHP

<?php
declare(strict_types=1);
return [
'global $e$2-$e$6' => [1, 'namedrangex'],
'global $f$2:$h$2' => [3, 'namedrangey'],
'global $f$4:$h$4' => [3, 'namedrange3'],
'local in scope $f$5:$i$5' => [4, 'namedrange5'],
'local out of scope' => ['#NAME?', 'localname'],
'non-existent sheet' => [10, 'UnknownSheet!B2:K6'],
'not enough arguments' => ['exception', 'omitted'],
'other existing sheet' => [6, 'OtherSheet!B1:G1'],
'qualified in scope $f$5:$i$5' => [4, 'ThisSheet!namedrange5'],
'single cell absolute' => [1, '$C$15'],
'single cell relative' => [1, 'C7'],
'unknown name' => ['#NAME?', 'namedrange2'],
'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' => [3, 'OtherSheet!localname'],
];