How to access cells with ref X,Y (2,4) rather than C5 ?

Topics: Developer Forum
Jan 5, 2009 at 11:48 AM
Edited Jan 5, 2009 at 11:49 AM
Hi all,
    Is there a way to access a cell with numeric x-y coordinates rather than the cell name? It would be very very usefull to create a table in a simple way (foreach, etc...).

This is the way does PEAR Spreafsheet_Excel_Writer :
$worksheet->write(00, 'text');


Thanks a lot!
Jan 5, 2009 at 11:56 AM
Edited Jan 5, 2009 at 12:04 PM
Hmm...

I guess it is the function named getCellByColumnAndRow() in Worksheet.php line 856, right ?

EDIT:
other functions are:
  • setCellValueByColumnAndRow()
  • cellExistsByColumnAndRow()
  • setCellValueExplicitByColumnAndRow()
  • getStyleByColumnAndRow()
  • setBreakByColumnAndRow()
  • mergeCellsByColumnAndRow()
  • unmergeCellsByColumnAndRow()
  • protectCellsByColumnAndRow()
  • unprotectCellsByColumnAndRow()
  • setAutoFilterByColumnAndRow()
  • freezePaneByColumnAndRow()
  • getCommentByColumnAndRow()
  • setSelectedCellByColumnAndRow()
  • etc(...)
:-)
Developer
Jan 5, 2009 at 1:27 PM
Yes, keep in mind that in PHPExcel column index is 0-based, but row index is 1-based.

getCell('A1')

is the same as

getCellByColumnAndRow(0, 1)

In PEAR Spreadsheet_Excel_Writer both are 0-based.
Jan 5, 2009 at 1:28 PM
Edited Jan 6, 2009 at 10:18 AM
Yeah, my title is wrong
"X,Y (2,4) rather than C5"... => is wrong: 2,4 is C4!!!