PHPExcel style problem

我与影子孤独终老i 提交于 2019-12-22 11:12:11

问题


$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Name');

1.How I set this to bold?

2.How I set the width(I will have some dinamic text in the cells!)?

I have read the documentation, but I haven't found any solutions!


回答1:


Bold:

$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);

Width:

$objPHPExcel->getActiveSheet()->getCell('A1')->setWidth(15);

Not tested though.




回答2:


$col zero 0 based

$worksheet->getColumnDimensionByColumn($col)->setWidth($width);

Hi 2009



来源:https://stackoverflow.com/questions/1858557/phpexcel-style-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!