我试过以下代码.
在特定行上应用行高
$objPHPExcel->getActiveSheet()->getRowDimension('7')->setRowHeight(-1);
为所有行应用行高
$objPHPExcel->getActiveSheet()->getDefaultRowDimension(1)->setRowHeight(-1);
$objPHPExcel->getActiveSheet()
->getStyle('B7')
->getAlignment()
->setWrapText(true);
但它给我的结果如下:
Note : Working in MS office,Not Working in Apache open Office and
LibreOffice
解决方法:
$value = "To be or not to be-that is the question: whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles, and, by opposing, end them.";
$objPHPExcel->getActiveSheet()->setCellValue('A12', $value);
$objPHPExcel->getActiveSheet()->getRowDimension(12)->setRowHeight(-1);
$objPHPExcel->getActiveSheet()->getStyle('A12')->getAlignment()->setWrapText(true);
这为Excel2007和Excel5 Writer创建了正确的包装输出
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。