We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Convert GridRangeInfo to Excel String Range

Thread ID:

Created:

Updated:

Platform:

Replies:

130763 May 31,2017 10:24 PM UTC Jun 5,2017 09:51 AM UTC Windows Forms 5
loading
Tags: GridControl
Chris Bishop
Asked On May 31, 2017 10:24 PM UTC

Hi,  I am working with GridRangeInfo to create ranges and also working with NamedRanges and need a way to convert from GridRangeInfo into "A1:B1" format.

Example:

                 var engine = ((GridFormulaCellModel) gridControl1.Model.CellModels["FormulaCell"]).Engine;
                 engine.AddNamedRange("Test", GridRangeInfo.Cells(1,1,2,2).Info);
                 var name = engine.NamedRangeValues.Values.OfType<String>().Single(s => s == "A1:B2");

Basically I want to convert between "A1:B2" format and GridRangeInfo.

Thanks



Arulpriya Ramalingam [Syncfusion]
Replied On June 1, 2017 10:03 AM UTC

Hi Chris, 

Thanks for your interest in Syncfusion products. 

We could able to understand your scenario. As per our current support of GridControl, the NamedRanges can be passed only as AlphaLabel ranges. So GridControl does not have direct support to convert the GridRangeInfo(i.e R1C2) to named ranges (i.e., A1).  Please refer the NamedRanges UG link to know more about NamedRanges. The reported scenario can be achieved by using GetAlphaLabel() method. GetAlphaLabel() can be used to get the AlphaLabel of the column. Please make use of below code and sample, 

Code snippet 
 
var engine = ((GridFormulaCellModel)gridControl1.Model.CellModels["FormulaCell"]).Engine; 
 
//To Pass the GridRange 
GridRangeInfo range = GridRangeInfo.Cells(1, 1, 2, 2); 
int topIndex = range.Top; 
int rightIndex = range.Right; 
 
//To get the alpha label for the cells 
string startAlpha = GridRangeInfo.GetAlphaLabel(range.Left); 
string endAlpha = GridRangeInfo.GetAlphaLabel(range.Right); 
 
//To convert the GridRange into AlphaLabelRange 
var namedRange = startAlpha + topIndex + ":" + endAlpha + rightIndex; 
 
//To add the namedrange 
engine.AddNamedRange("Test", namedRange); 
 
 

Regards, 
Arulpriya 


Chris Bishop
Replied On June 1, 2017 01:27 PM UTC

That is not acceptable.Your offer a GridControl that supports excel ranges in string format but use your own object for handling ranges in code and then do not provide a way to switch between them.  This is ludicrous that you expect the developer to create their own conversion method.  I need to switch between the two.If you don't have this feature it needs to be added.

Arulpriya Ramalingam [Syncfusion]
Replied On June 2, 2017 08:33 AM UTC

Hi Chris, 
 
Thanks for your update. 
 
We have created the separate incident for the reported scenario for better follow-up under your account. Please follow-up with that incident. 
 
 
Regards, 
Arulpriya 


Chris Bishop
Replied On June 2, 2017 01:40 PM UTC

Thank you,

I appreciate that.

Arulpriya Ramalingam [Syncfusion]
Replied On June 5, 2017 09:51 AM UTC

Hi Chris,  

Thanks for your appriciation. 

Arulpriya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;