1

I'm trying to set footer on the left side on my Excel sheet using phpExcel. I wrote this code but it didn't work :

$sheet->getHeaderFooter()->setOddFooter('myFooter');

By the way, I took a look at the documentation for the HeaderFooter Class but there is no methods to do it.

pnuts
  • 58,317
  • 11
  • 87
  • 139
drew02
  • 13
  • 1
  • 3

2 Answers2

4

If you read the PHPExcel Documentation (not simply the API docs), you'll see that you need to "tag" the footer value with & codes to identify right/center/left sections of the footer block, as well as for style codes, and functionality like page numbering.

The code for "left" is &L, so:

$sheet->getHeaderFooter()
    ->setOddFooter('&LmyFooter');
Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • @Mark Baker Maybe you can help me. Look at this : https://stackoverflow.com/questions/56522035/how-can-i-make-default-page-number-to-every-sheet-on-maatwebsitelaravel-excel – moses toh Jun 10 '19 at 09:50
0

Try this

$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('myFooter');
Dinuka Dayarathna
  • 169
  • 1
  • 3
  • 9