2019-11-27 16:52:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
|
|
|
|
|
|
|
|
use PhpOffice\PhpSpreadsheet\Shared\File;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class DefinedNameConfusedForCellTest extends TestCase
|
|
|
|
{
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testDefinedName(): void
|
2019-11-27 16:52:34 +00:00
|
|
|
{
|
|
|
|
$obj = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
|
|
|
$sheet0 = $obj->setActiveSheetIndex(0);
|
|
|
|
$sheet0->setCellValue('A1', 2);
|
|
|
|
$obj->addNamedRange(new \PhpOffice\PhpSpreadsheet\NamedRange('A1A', $sheet0, 'A1'));
|
|
|
|
$sheet0->setCellValue('B1', '=2*A1A');
|
|
|
|
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($obj, 'Xlsx');
|
|
|
|
$filename = tempnam(File::sysGetTempDir(), 'phpspreadsheet-test');
|
|
|
|
$writer->save($filename);
|
|
|
|
self::assertTrue(true);
|
2020-05-24 11:03:07 +00:00
|
|
|
unlink($filename);
|
2019-11-27 16:52:34 +00:00
|
|
|
}
|
|
|
|
}
|