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.

Named Ranges.

Thread ID:

Created:

Updated:

Platform:

Replies:

109762 Jul 2,2013 06:58 PM Jul 3,2013 02:14 AM WPF 1
loading
Tags: SpreadsheetControl(Classic)
Carlos Diaz
Asked On July 2, 2013 06:58 PM

Hello,

I'm trying to create Named Ranges from code but I'm unable to create them, basically I need to assign a name to a particular cell in order to reference it from other sheets.

Thanks in advance.

Carlos Diaz.

Pannir Selvam S [Syncfusion]
Replied On July 3, 2013 02:14 AM

Hi Carlos,

 

Thanks for contacting Syncfusion support.

 

You can define the named ranges in the Spreadsheet by using the following code snippet.

 

Code Snippet[C#]:

 
this.spreadSheetControl.WorkBookLoaded += spreadSheetControl_WorkBookLoaded;
 
void spreadSheetControl_WorkBookLoaded(object sender, WorkbookLoadedEventArgs args)
{
    IWorkbook workbook = this.spreadSheetControl.ExcelProperties.WorkBook;
    GridControl grid = this.spreadSheetControl.GridProperties.ActiveSpreadsheetGrid;
 
    IName name1 = workbook.Names.Add("FIRSTCELL");
    name1.RefersToRange = workbook.ActiveSheet.Range["A1"];
    grid.Model.FormulaEngine.AddNamedRange(name1.Name, name1.Value);
}

 

 

We have prepared a sample based on this and you can find the sample from the below location.

 

Please let us know if you have any other queries.

 

Regards,

Pannir



SpreadsheetDemo_WPF_39cd6eb2.zip

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.

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.

;