Class \avadim\FastExcelTemplator\RowTemplateCollection
On this page
- __construct() – RowTemplateCollection constructor
- addRowTemplate() – Add row template to collection
- cloneCell() – Clone cell in all row templates of the collection
- current() – Return the current element
- delRowTemplate() – Delete row template from collection
- key() – Return the key of the current element
- next() – Move forward with wrap-around for compatibility; insertRow() uses the independent nextTemplate() cycle.
- nextTemplate() – Select the next insertion template independently of foreach/next()/rewind(); insertRow() shares this cycle and copies the selected template, while add/delete restarts it.
- rewind() – Rewind the Iterator to the first element
- setSheet() – Set sheet template
- valid() – Checks if current position is valid
__construct()
public function __construct(?array $rowData = [],
?SheetTemplate $sheet = null)
RowTemplateCollection constructor
Parameters
array|null $rowDataSheetTemplate|null $sheet– Sheet the templates were captured from; some operations (cloneCell) need it, it can also be set later by setSheet()
addRowTemplate()
public function addRowTemplate($row, ?int $rowNum = 0): void
Add row template to collection
Parameters
RowTemplate $rowint|null $rowNum
cloneCell()
public function cloneCell(string $colSource, $colTarget,
?bool $checkMerge = false): RowTemplateCollection
Clone cell in all row templates of the collection
Parameters
string $colSourcestring|array $colTargetbool|null $checkMerge
current()
public function current(): mixed
Return the current element
Parameters
None
delRowTemplate()
public function delRowTemplate(int $rowNum): void
Delete row template from collection
Parameters
int $rowNum
key()
public function key(): mixed
Return the key of the current element
Parameters
None
next()
public function next(): mixed
Move forward with wrap-around for compatibility; insertRow() uses the independent nextTemplate() cycle.
Parameters
None
nextTemplate()
public function nextTemplate(): RowTemplate
Select the next insertion template independently of foreach/next()/rewind(); insertRow() shares this cycle and copies the selected template, while add/delete restarts it.
Parameters
None
rewind()
public function rewind(): mixed
Rewind the Iterator to the first element
Parameters
None
setSheet()
public function setSheet($sheet)
Set sheet template
Parameters
SheetTemplate $sheet
valid()
public function valid(): bool
Checks if current position is validSince next() deliberately wraps around, the position alone can never end a foreach.The counter reset by rewind() is what makes a foreach walk the collection exactly once.
Parameters
None