__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\Cell\AddressRange;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
class CellReferenceHelper
{
/**
* @var string
*/
protected $beforeCellAddress;
/**
* @var int
*/
protected $beforeColumn;
/**
* @var int
*/
protected $beforeRow;
/**
* @var int
*/
protected $numberOfColumns;
/**
* @var int
*/
protected $numberOfRows;
public function __construct(string $beforeCellAddress = 'A1', int $numberOfColumns = 0, int $numberOfRows = 0)
{
$this->beforeCellAddress = str_replace('$', '', $beforeCellAddress);
$this->numberOfColumns = $numberOfColumns;
$this->numberOfRows = $numberOfRows;
// Get coordinate of $beforeCellAddress
[$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($beforeCellAddress);
$this->beforeColumn = (int) Coordinate::columnIndexFromString($beforeColumn);
$this->beforeRow = (int) $beforeRow;
}
public function beforeCellAddress(): string
{
return $this->beforeCellAddress;
}
public function refreshRequired(string $beforeCellAddress, int $numberOfColumns, int $numberOfRows): bool
{
return $this->beforeCellAddress !== $beforeCellAddress ||
$this->numberOfColumns !== $numberOfColumns ||
$this->numberOfRows !== $numberOfRows;
}
public function updateCellReference(string $cellReference = 'A1', bool $includeAbsoluteReferences = false): string
{
if (Coordinate::coordinateIsRange($cellReference)) {
throw new Exception('Only single cell references may be passed to this method.');
}
// Get coordinate of $cellReference
[$newColumn, $newRow] = Coordinate::coordinateFromString($cellReference);
$newColumnIndex = (int) Coordinate::columnIndexFromString(str_replace('$', '', $newColumn));
$newRowIndex = (int) str_replace('$', '', $newRow);
$absoluteColumn = $newColumn[0] === '$' ? '$' : '';
$absoluteRow = $newRow[0] === '$' ? '$' : '';
// Verify which parts should be updated
if ($includeAbsoluteReferences === false) {
$updateColumn = (($absoluteColumn !== '$') && $newColumnIndex >= $this->beforeColumn);
$updateRow = (($absoluteRow !== '$') && $newRowIndex >= $this->beforeRow);
} else {
$updateColumn = ($newColumnIndex >= $this->beforeColumn);
$updateRow = ($newRowIndex >= $this->beforeRow);
}
// Create new column reference
if ($updateColumn) {
$newColumn = $this->updateColumnReference($newColumnIndex, $absoluteColumn);
}
// Create new row reference
if ($updateRow) {
$newRow = $this->updateRowReference($newRowIndex, $absoluteRow);
}
// Return new reference
return "{$newColumn}{$newRow}";
}
public function cellAddressInDeleteRange(string $cellAddress): bool
{
[$cellColumn, $cellRow] = Coordinate::coordinateFromString($cellAddress);
$cellColumnIndex = Coordinate::columnIndexFromString($cellColumn);
// Is cell within the range of rows/columns if we're deleting
if (
$this->numberOfRows < 0 &&
($cellRow >= ($this->beforeRow + $this->numberOfRows)) &&
($cellRow < $this->beforeRow)
) {
return true;
} elseif (
$this->numberOfColumns < 0 &&
($cellColumnIndex >= ($this->beforeColumn + $this->numberOfColumns)) &&
($cellColumnIndex < $this->beforeColumn)
) {
return true;
}
return false;
}
protected function updateColumnReference(int $newColumnIndex, string $absoluteColumn): string
{
$newColumn = Coordinate::stringFromColumnIndex(min($newColumnIndex + $this->numberOfColumns, AddressRange::MAX_COLUMN_INT));
return "{$absoluteColumn}{$newColumn}";
}
protected function updateRowReference(int $newRowIndex, string $absoluteRow): string
{
$newRow = $newRowIndex + $this->numberOfRows;
$newRow = ($newRow > AddressRange::MAX_ROW) ? AddressRange::MAX_ROW : $newRow;
return "{$absoluteRow}{$newRow}";
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Calculation | Folder | 0777 |
|
|
| Cell | Folder | 0777 |
|
|
| Chart | Folder | 0777 |
|
|
| Collection | Folder | 0777 |
|
|
| Document | Folder | 0777 |
|
|
| Helper | Folder | 0777 |
|
|
| Reader | Folder | 0777 |
|
|
| RichText | Folder | 0777 |
|
|
| Shared | Folder | 0777 |
|
|
| Style | Folder | 0777 |
|
|
| Worksheet | Folder | 0777 |
|
|
| Writer | Folder | 0777 |
|
|
| CellReferenceHelper.php | File | 4.26 KB | 0777 |
|
| Comment.php | File | 7.35 KB | 0777 |
|
| DefinedName.php | File | 6.41 KB | 0777 |
|
| Exception.php | File | 83 B | 0777 |
|
| HashTable.php | File | 3.76 KB | 0777 |
|
| IComparable.php | File | 182 B | 0777 |
|
| IOFactory.php | File | 8.81 KB | 0777 |
|
| NamedFormula.php | File | 973 B | 0777 |
|
| NamedRange.php | File | 1.22 KB | 0777 |
|
| ReferenceHelper.php | File | 54.04 KB | 0777 |
|
| Settings.php | File | 6 KB | 0777 |
|
| Spreadsheet.php | File | 45.3 KB | 0777 |
|
| Theme.php | File | 7 KB | 0777 |
|