PHPExcel_Style_Alignment for merged cells exported to PDF

Topics: Developer Forum, User Forum
Jun 6, 2013 at 4:20 AM
Edited Jun 6, 2013 at 4:31 AM
Hello. I need to create multiple column where the headers look something like this (please excuse the mad ASCII skillz):
|_sub 1__|__sub 2_|
Obviously, the “header” cell is two merged cells (e.g. C2:D2), while the “subs” are regular single cells. All three need to have centered text, so I’ve applied the PHPExcel_Style_Alignment to the whole range (e.g. C2:D3), and this works fine when the sheet is exported to XLS.

However, when I render a PDF (with mPDF), the centred style only gets applied to the unmerged “sub” cells, while the merged “header” cell gets the default left-alignment style. I tried applying the style for this cell individually, before and after the merge, none of that seemed to affect anything.

Once again, the issue only occurs in the generated PDF, the XLS is fine.

Any idea on how to resolve this?