0

I'm using PHPExcel and I have the next issue:

In the template I'm using, I must print the current page and total pages in some cells and this goes in a custom header that are IN the rows and not the header itself because the complex of the template.

I know, I can print those values in the header and footer but, is it possible to print the current page or total pages in a cell with PHPExcel?

Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137

1 Answers1

0

I assume that when you say 'pages' you mean worksheets.

To get the amount of worksheets in PHPExcel try the following snippet:

$objPHPExcel->getSheetCount()

To get the name/index of your current sheet, you just need to keep track of your navigation between sheets, since switching between them is done by index, or by name, like this.


If it help you can get the current sheet's name using
$sheetName = $objPHPExcel->getActiveSheet()->getTitle();

as mentioned here, and according to this documentation you can get the active sheet's index using

$sheetIndex = $objPHPExcel->getActiveSheetIndex();

Good luck!

Community
  • 1
  • 1
Alon Alexander
  • 135
  • 3
  • 10