Set text on top of cell while 1 cell on same row is setWrapText(true)

Viewed 29

I'm working with PHPExcel to export data from website. So far, everything works fine with me. Here is my result my result

But as you see, the text in cell is aligned bottom. This is due to I setWrapText(true) on column G to display multiline in 1 cell. How can I set the text in other cells on top?

Any suggestion will be appreciated. Thank you.

1 Answers

Besides the fact that you should really be working with PhpSpreadsheet rather than with the old, unsupported PhpExcel library:

$objPHPExcel->getActiveSheet()->getStyle('A1')
    ->getAlignment()
    ->setVerical(PHPExcel_Style_Alignment::VERTICAL_TOP);

as described in the doc

Related