How to handle dynamic colums in PhpExcel

Topics: Developer Forum, User Forum
Mar 27, 2009 at 9:51 AM
Hi

Im new in a discussion forums here...
i've been working on codeplex phpexcel for some month and today, i was asked to do a dynamic comparison table which needs me to handle a dynamic row and colums

i don't have any problems really in handling an X-Axis (row) data as i can loop in using number/integer

but i really come on stuck when i need to handle it VS dynamic colums as well as it is in an alphabetical order

could anyone suggest me the way of solving the problems?
thanks~!
Mar 27, 2009 at 10:05 AM
well, i can advice u to make an array like this (but with changed keys and value):
$colums = array(0=>"A",1=>"B",2=>"C",3=>"D",4=>"E",5=>"F",6=>"G",7=>"H",8=>"I",9=>"J",10=>"K",11=>"L",12=>"M",13=>"N",14=>"O",15=>"P",16=>"Q");

and to make a simple convertation by accessing it like it's a number
Mar 27, 2009 at 10:47 AM
You can easily loop the column with number/integer too.
Just use PHPExcel_Cell::stringFromColumnIndex($columnIndex)  method which convert a numeric index into the letter you need for your column ;-)
Mar 27, 2009 at 10:50 AM
Wow.. It's really cool!! thanks!! I had to write my own method that allows looping alphabetical cells )))