mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-23 09:22:26 +00:00
2259de578b
* Extract LookupRef\INDEX() into index() method of LookupRef\Matrix class Additional tests * Bugfix for returning a column using INDEX() * Some improvements to ROW() and COLUMN() * Simplify some of the INDEX() logic, eliminating redundant code
24 lines
696 B
PHP
24 lines
696 B
PHP
<?php
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
require __DIR__ . '/../../Header.php';
|
|
|
|
$helper->log('Returns the column index of a cell.');
|
|
|
|
// Create new PhpSpreadsheet object
|
|
$spreadsheet = new Spreadsheet();
|
|
$worksheet = $spreadsheet->getActiveSheet();
|
|
|
|
$worksheet->getCell('A1')->setValue('=COLUMN(C13)');
|
|
$worksheet->getCell('A2')->setValue('=COLUMN(E13:G15)');
|
|
$worksheet->getCell('F1')->setValue('=COLUMN()');
|
|
|
|
for ($row = 1; $row <= 2; ++$row) {
|
|
$cell = $worksheet->getCell("A{$row}");
|
|
$helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}");
|
|
}
|
|
|
|
$cell = $worksheet->getCell('F1');
|
|
$helper->log("F1: {$cell->getValue()} => {$cell->getCalculatedValue()}");
|