Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set cell padding in PHPExcel?

Tags:

php

phpexcel

Does anyone know how it's possible to set cell padding in PHPExcel ? Searched for 30mins and still can't find a proper solution. There is no useful documentation on this.

like image 947
Sliq Avatar asked Sep 20 '12 11:09

Sliq


2 Answers

Just to add, please note that this will only work if the horizontal alignment is set to left or right.

Should precede with this (if it has not already been done)

$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);

Cheers

like image 104
LC Yoong Avatar answered Nov 10 '22 22:11

LC Yoong


Maybe

$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setIndent(1);
like image 29
mr.frog Avatar answered Nov 10 '22 21:11

mr.frog