ALIGNMENT QUESTION

Oct 15, 2008 at 8:32 AM
I discovered when I transfer text to excel. Thise text also put on left side of cell.
But when I transfer number to excel. Thise number also put on right side of cell.
I want to know how can I edit the alignment. That can put number also on left side of cell??
Thank You So Much~~
Developer
Oct 15, 2008 at 2:55 PM
I prefer using the the duplicateStyleArray() method of the worksheet whenever I need to style a whole range of cells. Example:

$excel = new PHPExcel();
$sheet = $excel->getActiveSheet();
$sheet->getCell('A1')->setValue(123);
$sheet->getCell('A2')->setValue(3.7);
$sheet->duplicateStyleArray(
    array(
        'alignment' => array(
            'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
        ),
    ),
    'A1:A20'
);
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
$writer->save('test.xls');


Check the documentation where you will find the complete list of what you can put in the style array.