如何增加单元格A1的高度:php excel中的H1

时间:2015-01-22 06:34:41

标签: php html css excel codeigniter

我在codeigniter中使用phpexcel,我想在第一列打印徽标,但是我无法为A1到H1的特定合并列设置单元格高度

我尝试了以下方式,但我无法获得解决方案

$this->excel->getActiveSheet()->getRowDimension('A1')->setRowHeight(300);
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./images/multiply.png');
$this->excel->getActiveSheet()->mergeCells('A1:H1');
$this->excel->getActiveSheet()->getRowDimension('A1')->setRowHeight(300);
$this->excel->getActiveSheet()->getStyle('A1:H1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objDrawing->setCoordinates('A1');
$objDrawing->setHeight(100);
$objDrawing->setWidth(100);
$objDrawing->setWorksheet($this->excel->getActiveSheet());

请建议我任何方式

这是本规范所显示的内容 This Is what showing by this Code

但我想要这样 But I Want Like this

1 个答案:

答案 0 :(得分:2)

最近碰巧做了一个,你可以从

中得到这个想法
$column='A';
$row=2;
$excel = new PHPExcel();
$excel->getActiveSheet()->getRowDimension($row)->setRowHeight(200);
$excel->getActiveSheet()->getColumnDimension($column)->setWidth(50);