implémenter la fusion des cellules

This commit is contained in:
Jephté Clain 2025-01-24 17:08:57 +04:00
parent 099cdcfc3e
commit 11724eef98

View File

@ -29,8 +29,14 @@ class SpoutBuilder extends AbstractBuilder {
protected static function apply_params($object, ?array $params, array $refParams) {
foreach (array_keys($refParams) as $method) {
if (!str::starts_with("->", $method)) continue;
if (cl::has($params, $method)) {
func::with([$object, $method])->invoke(cl::with($params[$method]));
$func = func::with([$object, $method]);
if (($args = $params[$method] ?? null) !== null) {
$func->invoke(cl::with($args));
}
if (($argss = $params["$method*"] ?? null) !== null) {
foreach ($argss as $args) {
$func->invoke(cl::with($args));
}
}
}
return $object;
@ -314,6 +320,14 @@ class SpoutBuilder extends AbstractBuilder {
return $this;
}
/**
* les colonnes sont indexées sur 0 (e.g A = 0, B = 1, etc.)
* Les lignes sont indexées sur 1
*/
function mergeCells(int $topLeftCol, int $topLeftRow, int $bottomRightCol, int $bottomRightRow): void {
$this->ssWriter->mergeCells([$topLeftCol, $topLeftRow], [$bottomRightCol, $bottomRightRow]);
}
protected function isNumeric($value): bool {
if ($this->typeNumeric && is_numeric($value)) return true;
if (!is_string($value) && is_numeric($value)) return true;