Column name

Hi,


I can't figure out how to get column names by its index. Like 1 => "A".
Found nothing in manual nor in the examples / sources.

thx

Hi,

The simplest way is to remember to use TCellAddress ( http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.Core/TCellAddress/index.html )for both converting 1=>A and A=>1. 

You have "EncodeColumn" http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.Core/TCellAddress/EncodeColumn.html
which will do what you want, but normally it is simpler to just create a TCellAddress record and use it to convert. For example:

//Convert from B5 to 5,2
a := TCellAddress.Create('B5');
xls.GetCellValue(a.Row, a.Col);

or

//Convert from 5,2 to B5:
 a := TCellAddress.Create(5, 2);
  DoSomething(a.CellRef);  //CellRef has the text "B5"

Those examples were taken from:
http://www.tmssoftware.biz/flexcel/doc/vcl/tips/expanding-formulas.html

Adrian, 


Thank you. "EncodeColumn" is the winner as I need column names and not cell references.
It's not too intuitive but now as I have it, it doesn't matter anymore.

Thx for the prompt reply!