How to align text on Merged Cells?

Topics: Developer Forum
Dec 18, 2013 at 7:58 PM
Edited Dec 18, 2013 at 7:59 PM
Hi
I want to align the text on merged cells.I am using the below code.
But it's not giving the desire result.
I want to print to pdf file.
$objPHPExcel->getActiveSheet()->mergeCells('A1:D1');
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
Please help me.