support hauteur de ligne

This commit is contained in:
Jephté Clain 2024-11-30 11:18:58 +04:00
parent 60dfb1e177
commit fd68d0ecd5
2 changed files with 15 additions and 1 deletions

View File

@ -348,6 +348,14 @@ class SpoutBuilder extends AbstractBuilder {
} }
function _write(array $row, ?array $colStyles=null, ?array $rowStyle=null): void { function _write(array $row, ?array $colStyles=null, ?array $rowStyle=null): void {
$rowParams = null;
if ($rowStyle !== null) {
foreach (array_keys(ref_params::ROW) as $method) {
$value = $rowStyle[$method] ?? null;
unset($rowStyle[$method]);
if ($value !== null) $rowParams[$method] = $value;
}
}
$sheetParams = $this->sheetParams; $sheetParams = $this->sheetParams;
$headerStyle = $sheetParams["header_style"] ?? null; $headerStyle = $sheetParams["header_style"] ?? null;
$oddStyle = $sheetParams["odd_style"] ?? null; $oddStyle = $sheetParams["odd_style"] ?? null;
@ -379,7 +387,9 @@ class SpoutBuilder extends AbstractBuilder {
} }
$rowStyle ??= $oddStyle; $rowStyle ??= $oddStyle;
self::ensure_style($rowStyle); self::ensure_style($rowStyle);
$this->writer->addRow(WriterEntityFactory::createRow($cells, $rowStyle)); $row = WriterEntityFactory::createRow($cells, $rowStyle);
self::apply_params($row, $rowParams, ref_params::ROW);
$this->writer->addRow($row);
if ($differentOddEven) $this->oddEvenIndex++; if ($differentOddEven) $this->oddEvenIndex++;
} }

View File

@ -24,6 +24,10 @@ class ref_params {
"different_odd_even" => "bool", "different_odd_even" => "bool",
]; ];
const ROW = [
"->setHeight" => ["float"],
];
const COLORS = [ const COLORS = [
"black" => Color::BLACK, "black" => Color::BLACK,
"white" => Color::WHITE, "white" => Color::WHITE,