| 1 |
<?php |
| 2 |
|
| 3 |
namespace PhpOffice\PhpSpreadsheet\Worksheet; |
| 4 |
|
| 5 |
use PhpOffice\PhpSpreadsheet\Calculation\Functions; |
| 6 |
use PhpOffice\PhpSpreadsheet\Cell\CellAddress; |
| 7 |
use PhpOffice\PhpSpreadsheet\Cell\Coordinate; |
| 8 |
|
| 9 |
class PageBreak |
| 10 |
{ |
| 11 |
/** @var int */ |
| 12 |
private $breakType; |
| 13 |
|
| 14 |
/** @var string */ |
| 15 |
private $coordinate; |
| 16 |
|
| 17 |
/** @var int */ |
| 18 |
private $maxColOrRow; |
| 19 |
|
| 20 |
/** @param array|CellAddress|string $coordinate */ |
| 21 |
public function __construct(int $breakType, $coordinate, int $maxColOrRow = -1) |
| 22 |
{ |
| 23 |
$coordinate = Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)); |
| 24 |
$this->breakType = $breakType; |
| 25 |
$this->coordinate = $coordinate; |
| 26 |
$this->maxColOrRow = $maxColOrRow; |
| 27 |
} |
| 28 |
|
| 29 |
public function getBreakType(): int |
| 30 |
{ |
| 31 |
return $this->breakType; |
| 32 |
} |
| 33 |
|
| 34 |
public function getCoordinate(): string |
| 35 |
{ |
| 36 |
return $this->coordinate; |
| 37 |
} |
| 38 |
|
| 39 |
public function getMaxColOrRow(): int |
| 40 |
{ |
| 41 |
return $this->maxColOrRow; |
| 42 |
} |
| 43 |
|
| 44 |
public function getColumnInt(): int |
| 45 |
{ |
| 46 |
return Coordinate::indexesFromString($this->coordinate)[0]; |
| 47 |
} |
| 48 |
|
| 49 |
public function getRow(): int |
| 50 |
{ |
| 51 |
return Coordinate::indexesFromString($this->coordinate)[1]; |
| 52 |
} |
| 53 |
|
| 54 |
public function getColumnString(): string |
| 55 |
{ |
| 56 |
return Coordinate::indexesFromString($this->coordinate)[2]; |
| 57 |
} |
| 58 |
} |
| 59 |
|