Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Setting "active" cell #620

Closed
dirtyrobinson opened this issue Aug 1, 2015 · 6 comments
Closed

Setting "active" cell #620

dirtyrobinson opened this issue Aug 1, 2015 · 6 comments

Comments

@dirtyrobinson
Copy link

I am trying to create a spreadsheet that needs to be saved with a specific cell active upon opening. I have looked through a ton of documentation and couldn't find a way to set an active cell before writing the spreadsheet.

For instance, when a user opens the spreadsheet, the selected cell needs to be the last cell in the G column of the second worksheet, lets say cell G340. Obviously, I can use setActiveSheetIndex(1) to have the spreadsheet open to the second worksheet but can I get it to save where the selected cell is G340?

@MarkBaker
Copy link
Member

$objPHPExcel->getActiveSheet()->setSelectedCell('G340');

@dirtyrobinson
Copy link
Author

I'm really sorry, I'm not sure how I overlooked that in the documentation. Anyways, I quickly ran into another issue. The issue is freezing the first row of the worksheet. If I freeze the first row using:

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

Then the selected cell is A2 but if I comment out this line then the selected code is the one set using setSelectedCell('G340).

Is this there a way around this or is that just how it is?

@zlatevbg
Copy link

I have the same problem. The active cell is always on the first column of the freeze pane row

@mrtndimitrov
Copy link

The thing is that $objPHPExcel->getActiveSheet()->freezePane('A2'); will move the active cell to A2 so first freeze the row then use setSelectedCell as:

$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()->setSelectedCell('A1');

@asbdevs
Copy link

asbdevs commented May 22, 2018

The thing is that $objPHPExcel->getActiveSheet()->freezePane('A2'); will move the active cell to A2 so first freeze the row then use setSelectedCell as:

$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()->setSelectedCell('A1');

I tried this and doesn't work

@damiandennis
Copy link

Yup same problem here, freezePane first and then selectedCell does not fix the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants