43 public static function OFFSET($cellAddress =
null,
$rows = 0,
$columns = 0, $height =
null, $width =
null, ?
Cell $pCell =
null)
50 if ($cellAddress ===
null || $cellAddress ===
'') {
54 if (!is_object($pCell)) {
60 $startCell = $endCell = $cellAddress;
61 if (strpos($cellAddress,
':')) {
62 [$startCell, $endCell] = explode(
':', $cellAddress);
67 $startCellRow +=
$rows;
71 if (($startCellRow <= 0) || ($startCellColumn < 0)) {
80 if (($endCellRow <= 0) || ($endCellColumn < 0)) {
85 $cellAddress =
"{$startCellColumn}{$startCellRow}";
86 if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
87 $cellAddress .=
":{$endCellColumn}{$endCellRow}";
96 ->extractCellRange($cellAddress, $pSheet,
false);
102 if (strpos($cellAddress,
'!') !==
false) {
103 [$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress,
true);
104 $sheetName = trim($sheetName,
"'");
107 $pSheet = ($sheetName !==
'')
108 ? $pCell->
getWorksheet()->getParent()->getSheetByName($sheetName)
111 return [$cellAddress, $pSheet];
117 if (($width !==
null) && (!is_object($width))) {
118 $endCellColumn = $startCellColumn + (int) $width - 1;
123 return $endCellColumn;
128 if (($height !==
null) && (!is_object($height))) {
129 $endCellRow = $startCellRow + (int) $height - 1;
131 $endCellRow += (int)
$rows;
An exception for terminatinating execution or to throw for unit testing.
static getInstance(?Spreadsheet $spreadsheet=null)
Get an instance of this class.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
static OFFSET($cellAddress=null, $rows=0, $columns=0, $height=null, $width=null, ?Cell $pCell=null)
OFFSET.
static extractRequiredCells(?Worksheet $pSheet, string $cellAddress)
static adustEndCellRowForHeight($height, int $startCellRow, $rows, $endCellRow)
static extractWorksheet($cellAddress, Cell $pCell)
static adjustEndCellColumnForWidth(string $endCellColumn, $width, int $startCellColumn, $columns)
getWorksheet()
Get parent worksheet.
Helper class to manipulate cell coordinates.
static coordinateFromString($pCoordinateString)
Coordinate from string.
static columnIndexFromString($pString)
Column index from string.
static stringFromColumnIndex($columnIndex)
String from column index.