Fix Sample39 (#2664)
Sample39 was not adjusted when Defined Name support was changed to include both relative and absolute addresses. As a result, the Xlsx output is currently incorrect. The Xls output is in even worse shape, since PhpSpreadsheet 'Cannot yet write formulae with defined names to Xls' (see Writer/Xls/Parser.php). (Working around that restriction was the reason for my first contribution to this project.) The sample is changed to define its named ranges properly, and to produce only Xlsx output.
This commit is contained in:
parent
bd2e7b64a6
commit
ce5f91e6a1
|
|
@ -46,7 +46,7 @@ foreach ($continents as $key => $filename) {
|
|||
new NamedRange(
|
||||
$continent,
|
||||
$spreadsheet->getActiveSheet(),
|
||||
$column . '1:' . $column . $countryCount
|
||||
'$' . $column . '$1:$' . $column . '$' . $countryCount
|
||||
)
|
||||
);
|
||||
$spreadsheet->getActiveSheet()
|
||||
|
|
@ -68,7 +68,7 @@ $spreadsheet->addNamedRange(
|
|||
new NamedRange(
|
||||
'Continents',
|
||||
$spreadsheet->getActiveSheet(),
|
||||
$continentColumn . '1:' . $continentColumn . count($continents)
|
||||
'$' . $continentColumn . '$1:$' . $continentColumn . '$' . count($continents)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
@ -126,4 +126,5 @@ $spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(12);
|
|||
$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(30);
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__);
|
||||
$helper->log('Not writing to Xls - formulae with defined names not yet supported');
|
||||
$helper->write($spreadsheet, __FILE__, ['Xlsx']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue