Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPExcel Freezepane not working

Tags:

php

phpexcel

for ($char = 'A'; $char <= 'Z'; $char++) {
  $objPHPExcel->getActiveSheet()->setCellValue($char.'5','40');
}
for ($i=1;$i<=100;$i++){
    $objPHPExcel->getActiveSheet()->setCellValue('A'.$i,generateRandomString());
}
$objPHPExcel->getActiveSheet()->freezePane('B');
// Write the PHPExcel object to browser as HTML
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save('php://output');

$objPHPExcel->getActiveSheet()->freezePane('B');

Freeze not happened for the " A " (First column) column.

Attached screen shot FYI.showing first column(A Col) details here Freeze not happened for the " A " (First column) column. When i scroll COL A not freeze, col A also hidding. When i scroll COL A not freeze, col A also hidding.

like image 903
Bharanikumar Avatar asked Jun 14 '13 09:06

Bharanikumar


2 Answers

the freezePane() coordinate should be a cell reference for the top-left cell of the non-frozen part of the worksheet, so

$objPHPExcel->getActiveSheet()->freezePane('B2');

tells Excel to freeze rows above row 2, and to the left of column "B"... i.e. row 1 and column "A" will be frozen.

like image 169
Mark Baker Avatar answered Sep 20 '22 21:09

Mark Baker


Try this:

$ColumnCount=0;
$RowIndex=8;
$objPHPExcel->getActiveSheet()->freezePaneByColumnAndRow($ColumnCount, $RowIndex);
like image 44
tamil arasan Avatar answered Sep 22 '22 21:09

tamil arasan