Using PHPSpreadsheet, I created a Style object and set everything it needed. For instance:
$dateformat = new PhpOffice\PhpSpreadsheet\Style\NumberFormat();
$dateformat->setFormatCode($row['format']);
But I don't see any way to pass that object to style my cells, the only method I can see is setStyleArray($array)
.
So then I looked at the style object, and I noticed that this had a getStyleArray($array)
method. But it takes IN an array, and just returns it in another key:
/**
* Build style array from subcomponents.
*
* @param array $array
*
* @return array
*/
public function getStyleArray($array)
{
return ['quotePrefix' => $array];
}
So that's also pretty useless. So my question is simple. Is it even possible? Or must we work with the arrays? If so, what is the point of these objects if we can't use them effectively?