I want to set the wordwrap property to a particular column. I have set the fixed width for that column. But when text is large it goes into the next cell. I want to wrap that text in same column.
I am using the phpExcel extension to export the data.
Here is the code.
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, "Sr No");
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, "Query");
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $row, "Additional Detail.");
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(60);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(60);
Want to set wordwrap property to column B in my above code. Any help would be appreciated!
Wordwrap is set for individual cells, or for a range of cells, not for a specific column
$objPHPExcel->getActiveSheet()
->getStyle('B1:B100')
->getAlignment()
->setWrapText(true);
You may also want to set vertical alignment for those cells as well
$objPHPExcel->getActiveSheet()
->getStyle('B1:B100')
->getAlignment()
->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);