How to activate wrap text on a cell

Topics: Developer Forum, User Forum
Nov 28, 2007 at 4:11 PM
hello,


I don't understand how to use text wrapping. I've got some cells where I must activate this function.

can you help me?


thank you


matthieu
Coordinator
Nov 28, 2007 at 7:07 PM
Please check the API documentation for more information on text wrapping: PHPExcelStyleAlignment::setWrapText()
Nov 28, 2007 at 8:05 PM
yes, i saw that before

http://koucz.lkfs.org.pl/exel/Exel3/exel/Documentation/API/PHPExcelStyle/PHPExcelStyle_Alignment.html#methodsetWrapText

but how to use in my code



$objPHPExcel->getAlignment()->setWrapText($style->alignment"wrapText" == "true");
$objPHPExcel->getActiveSheet()->setCellValue('B1','nbr of accounts');
$objPHPExcel->getActiveSheet()->setCellValue('C1','having accessed');
$objPHPExcel->getActiveSheet()->setCellValue('F1','total nbr of orders');
$objPHPExcel->getActiveSheet()->setCellValue('H1','nbr of accnts ordering');
$objPHPExcel->getActiveSheet()->getRowDimension('1')->SetRowHeight(40);

doesn't work, of course
where can I change de WrapText style ?

I don't find any general help for things like that with phpexcel, only long list like the previous link, where i understand nothing, sorry
Coordinator
Nov 29, 2007 at 8:57 AM
This API documentation is actually an overview of al lclasses and methods in PHPExcel.
You can see which classes are used in other classes, and deduct almost every possibility in PHPExcel.

Alignment can be set like this:
$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
May 28, 2010 at 9:04 AM

Yes but with Excel 2000 setWrapText didn't work. I use Excel5.

I try $objPHPExcel->getActiveSheet()->getStyle('D12')->getAlignment()->setWrapText(true);

or $objPHPExcel->getActiveSheet()->getStyle('D12')->applyFromArray(
                    array(
                        'font'    => array(
                            'size'        => 8
                        ),
                                                'alignment' => array(
                            'wrapText' => true
                        ),
                    ),
                    'D12'
            );

When I open the generate file, the file is empty. It's possible for Excel 2000 ?

Sorry for my English