1 | <?php |
||
13 | class Sheet |
||
14 | { |
||
15 | const DEFAULT_SHEET_NAME_PREFIX = 'Sheet'; |
||
16 | |||
17 | /** @var int Index of the sheet, based on order in the workbook (zero-based) */ |
||
18 | private $index; |
||
19 | |||
20 | /** @var string ID of the sheet's associated workbook. Used to restrict sheet name uniqueness enforcement to a single workbook */ |
||
21 | private $associatedWorkbookId; |
||
22 | |||
23 | /** @var string Name of the sheet */ |
||
24 | private $name; |
||
25 | |||
26 | /** @var SheetManager Sheet manager */ |
||
27 | private $sheetManager; |
||
28 | |||
29 | /** |
||
30 | * @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based) |
||
31 | * @param string $associatedWorkbookId ID of the sheet's associated workbook |
||
32 | * @param SheetManager $sheetManager |
||
33 | */ |
||
34 | 107 | public function __construct($sheetIndex, $associatedWorkbookId, SheetManager $sheetManager) |
|
44 | |||
45 | /** |
||
46 | * @api |
||
47 | * @return int Index of the sheet, based on order in the workbook (zero-based) |
||
48 | */ |
||
49 | 107 | public function getIndex() |
|
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 107 | public function getAssociatedWorkbookId() |
|
61 | |||
62 | /** |
||
63 | * @api |
||
64 | * @return string Name of the sheet |
||
65 | */ |
||
66 | 107 | public function getName() |
|
70 | |||
71 | /** |
||
72 | * Sets the name of the sheet. Note that Excel has some restrictions on the name: |
||
73 | * - it should not be blank |
||
74 | * - it should not exceed 31 characters |
||
75 | * - it should not contain these characters: \ / ? * : [ or ] |
||
76 | * - it should be unique |
||
77 | * |
||
78 | * @api |
||
79 | * @param string $name Name of the sheet |
||
80 | * @return Sheet |
||
81 | * @throws \Box\Spout\Writer\Exception\InvalidSheetNameException If the sheet's name is invalid. |
||
82 | */ |
||
83 | 107 | public function setName($name) |
|
93 | } |
||
94 |