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