How to get Column + Row header index

Hello All:

How can I get column header index(A,B,C...) + row header index(1,2,3)

like
we give GridControl(1,1) and get "A1"
we give GridControl(1,2) and get "B1"
...

Think for any help.

Best Regards

Quenton


5 Replies

SR Sri Rajan Syncfusion Team August 26, 2008 06:52 AM UTC

Hi Quenton,

Thank you for your interest in Syncfusion products.

Please try this code to get "A1" for the cell (1,1) and let me know if this helps.

Console.WriteLine(GridRangeInfo.GetAlphaLabel(1)+GridRangeInfo.GetNumericLabel(1));


Note:
GridRangeInfo.GetAlphaLabel(Column Index) - Returns a string in the format "A, B, C,....AA, AB,...." to be used for column labels.
GridRangeInfo.GetNumericLabel(Row Index) - Returns a numeric string in the format to be used for row labels.

Best Regards,
Srirajan.




AD Administrator Syncfusion Team August 26, 2008 07:16 AM UTC

Hi Srirajan :

Thank for your reply,it's very helpful.

Best Regards

Quenton



AD Administrator Syncfusion Team August 26, 2008 07:28 AM UTC

Hi Srirajan:

By the way . How can I reverse it?

like
give A1 and get row index = 1 , col index = 1
give B1 and get row index = 1 , col index = 2

Best Regards

Quenton



SR Sri Rajan Syncfusion Team August 26, 2008 10:20 AM UTC

Hi Quenton,

Thank you for your interest in Syncfusion products.

Here is the code to get the row and column index from a cell reference(Example:"A1").

GridFormulaEngine engine=new GridFormulaEngine(this.gridControl1.Model);
Console.WriteLine("RowIndex : " + engine.RowIndex("A1") + " , ColIndex : " + engine.ColIndex("A1"));


Note:
engine.RowIndex(string s) - Returns a row index from a cell reference.
engine.ColIndex(string s) - Returns a column index from a cell reference.

Please let me know if this helps.

Best Regards,
Srirajan.



AD Administrator Syncfusion Team August 27, 2008 01:04 AM UTC

Hi Srirajan :

Thank for your reply again,it's very helpful.

Best Regards,
Quenton.


Loader.
Up arrow icon