How to achieve stacked text from top-to-bottom in PHPExcel

Topics: User Forum
Developer
Sep 5, 2008 at 12:29 AM
This post is for those who want stacked text using PHPExcel. In Excel it is possible to stack text in a cell from top-to-bottom. This is not quite the same as rotating the text.
E
x
a
m
p
l
e

So how do we do this in PHPExcel? Set the rotation angle to -165. Generally only values between -90 and 90 are accepted to indicate rotated text plus the value -165 to indicate stacked text.

Example:

$styleArray = array(
    'alignment' => array(
        'rotation' => -165,
    ),
);
$worksheet->getStyle('A1')->applyFromArray($styleArray);