Class \avadim\FastExcelTemplator\RowTemplate
On this page
- __construct()
- Parameters
- addCell()
- Parameters
- Examples
- appendCell()
- Parameters
- Examples
- attribute()
- Parameters
- cells()
- Parameters
- cloneCell()
- Parameters
- current()
- Parameters
- getAttributes()
- Parameters
- getSheetTemplate()
- Parameters
- getValue()
- Parameters
- getValues()
- Parameters
- key()
- Parameters
- next()
- Parameters
- removeCell()
- Parameters
- Examples
- removeCells()
- Parameters
- Examples
- rewind()
- Parameters
- rowHeight()
- Parameters
- rowNumber()
- Parameters
- setAttributes()
- Parameters
- setCellStyle()
- Parameters
- setRowStyle()
- Parameters
- setSheetTemplate()
- Parameters
- setValue()
- Parameters
- Examples
- setValues()
- Parameters
- Examples
- valid()
- Parameters
- withValue()
- Parameters
- Examples
- withValues()
- Parameters
- Examples
- __construct() – RowTemplate constructor
- addCell() – Add a cell to the row
- appendCell() – Append a source cell to the end of the row
- attribute() – Source row attribute
- cells() – Get all cells of the row
- cloneCell() – Clone a cell
- current() – Return the current element
- getAttributes() – All source row attributes
- getSheetTemplate() – Get sheet template
- getValue() – Returns value of cell
- getValues() – Get values of all cells of the row
- key() – Return the key of the current element
- next() – Move forward to next element
- removeCell() – Mark a cell for row-local removal and left-shifting during transfer; unknown columns are ignored, horizontal merges shrink and affected multi-row merges are rejected.
- removeCells() – Mark cells for row-local removal and left-shifting during transfer, using removeCell() semantics; references in other cells are not rewritten.
- rewind() – Rewind the Iterator to the first element
- rowHeight() – Source row height
- rowNumber() – Source row number
- setAttributes() – Set row attributes
- setCellStyle() – Set cell style
- setRowStyle() – Set row style
- setSheetTemplate() – Set sheet template
- setValue() – Set cell value; null clears content and the old formula while retaining formatting
- setValues() – Set multiple cell values
- valid() – Checks if current position is valid
- withValue() – Assign a value to the last added cell
- withValues() – Assign values to the last added cells
__construct()
public function __construct(?array $cellData = [])
RowTemplate constructor
Parameters
array|null $cellData
addCell()
public function addCell(string $colLetter, $value, $style): RowTemplate
Add a cell to the row
Parameters
string $colLettermixed $valuemixed|null $style
Examples
$row->addCell('G', $value);
appendCell()
public function appendCell(?string $colSource = null,
?int $number = null): RowTemplate
Append a source cell to the end of the row
Parameters
string|null $colSourceint|null $number
Examples
$row->appendCell('E'); // Append cell like E to the end of the row
$row->appendCell('E', 2); // Append two cells like E to the end of the row
attribute()
public function attribute($name): ?string
Source row attribute
Parameters
string $name
cells()
public function cells(): array
Get all cells of the row
Parameters
None
cloneCell()
public function cloneCell(string $colSource, $colTarget,
?bool $checkMerge = false): RowTemplate
Clone a cell
Parameters
string $colSourcestring|string[] $colTargetbool|null $checkMerge
current()
public function current(): mixed
Return the current element
Parameters
None
getAttributes()
public function getAttributes(): array
All source row attributes
Parameters
None
getSheetTemplate()
public function getSheetTemplate(): ?SheetTemplate
Get sheet template
Parameters
None
getValue()
public function getValue(string $colLetter): mixed|null
Returns value of cell
Parameters
string $colLetter
getValues()
public function getValues(): array
Get values of all cells of the row
Parameters
None
key()
public function key(): mixed
Return the key of the current element
Parameters
None
next()
public function next(): void
Move forward to next element
Parameters
None
removeCell()
public function removeCell(string $col): RowTemplate
Mark a cell for row-local removal and left-shifting during transfer; unknown columns are ignored, horizontal merges shrink and affected multi-row merges are rejected.
Parameters
string $col
Examples
$row->removeCell('G');
removeCells()
public function removeCells(array $cols): RowTemplate
Mark cells for row-local removal and left-shifting during transfer, using removeCell() semantics; references in other cells are not rewritten.
Parameters
string[] $cols
Examples
$row->removeCells(['G', 'H']);
rewind()
public function rewind(): void
Rewind the Iterator to the first element
Parameters
None
rowHeight()
public function rowHeight(): ?string
Source row height
Parameters
None
rowNumber()
public function rowNumber(): ?int
Source row number
Parameters
None
setAttributes()
public function setAttributes(array $attributes): RowTemplate
Set row attributes
Parameters
array $attributes
setCellStyle()
public function setCellStyle(string $colLetter, $style): RowTemplate
Set cell style
Parameters
string $colLettermixed $style
setRowStyle()
public function setRowStyle($style): RowTemplate
Set row style
Parameters
mixed $style
setSheetTemplate()
public function setSheetTemplate(avadim\FastExcelTemplator\SheetTemplate $sheetTemplate): RowTemplate
Set sheet template
Parameters
SheetTemplate $sheetTemplate
setValue()
public function setValue(string $colLetter, $value): RowTemplate
Set cell value; null clears content and the old formula while retaining formatting
Parameters
string $colLetter– Column letter, case-insensitivemixed $value– Scalar or null; a string starting with '=' is a formula
Examples
$row->setValue('G', '=SUM(A1:A10)');
setValues()
public function setValues(array $values): RowTemplate
Set multiple cell values
Parameters
array $values
Examples
$row->setValues(['G' => '=SUM(A1:A10)', 'H' => 'value']);
valid()
public function valid(): bool
Checks if current position is valid
Parameters
None
withValue()
public function withValue($value): RowTemplate
Assign a value to the last added cell
Parameters
mixed $value
Examples
$row->appendCell('E')->withValue('value');
withValues()
public function withValues(array $values): RowTemplate
Assign values to the last added cells
Parameters
array $values
Examples
$row->appendCell('E', 2)->withValues(['value1', 'value2']);