I noticed that the developer of PHPExcel reads this forum, so I'm formatting my problem as a direct question to him.
I'm trying to take the full styling of a cell from a template excel document and copy it to a new document.
As far as I can see, there is a Cell->getStyle() method, which gives back a style object. But there is no way to apply this style object to another cell.
To apply a style, one has to use a different function, Cell->getStyle('A1')->applyFromArray($styleArray) . This function take a differently formatting input - a style array. And there is not way to convert from a style object to a style array. Why is that? Why isn't here a method cell->setStyle()?
I also noticed that there is yet another method that might help me, Worksheet->duplicateStyle():
$targetWorksheet->duplicateStyle(
$sourceWorksheet->getStyle($sourceCellCoordinate),
$targetCellCoordinate
);
But, when using this method to copy TemplateA1->TargetA1, then TemplateB2->TargetB2, the moment that I copy the second cell, the first cell (TargetA1) gets re-styled to also have the second style (TargetB2). So that does not work neither.
I've invested about an hour looking into this, and my next step would probably be to implement a style object -> style array converter.
Any help would be appreciated.
Thanks!