php_excel07-如何根据单元格的内容修复最小高度和麦高以增加高度 [英] php_excel07- how to fix min heigth and mak to grow height based on the contents of a cell

查看:123
本文介绍了php_excel07-如何根据单元格的内容修复最小高度和麦高以增加高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将数据导出到xlsx,其中导出的文件应采用预定义的格式.这些,因为我正在使用"PHPexcel".我创建了某种格式的模板,每一行都有指定的高度.

I have to Export data to xlsx, where the exported file should be in a pre defined format. Becoz of these i am using "PHPexcel". And i created a template of some format with each row with some specified height.

实际上,我将在每个单元格中动态写入数据.因此,如果文本较大,则行高不会增加.

Actually in each cell i will be writing the data dynamically. so if the text is larger, then the row height in not increased.

无论如何还是要这样做,以便增加行的高度以适合单元格文本.

So is ther anyway so tat row height is increased to fit the cell text.

推荐答案

要将行设置为自动调整:

To set a row to autofit:

$objPHPExcel->getActiveSheet()->getRowDimension(10)->setAutoSize(true);

然后将各个单元格设置为允许包装

And then set the individual cells to allow wrapping

$objPHPExcel->getActiveSheet()->getStyle('A10:D10')->getAlignment()->setWrapText(true);

这篇关于php_excel07-如何根据单元格的内容修复最小高度和麦高以增加高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆