Posted 7 April 2019, 11:50 pm EST
Can I set the range of a “named range” from the code behind with Spread.NET 10? or Spread.NET 12?
Forums Home / Spread / Spread for ASP.NET (Web Forms)
Posted by: GEPHILLIPS on 7 April 2019, 11:50 pm EST
Posted 7 April 2019, 11:50 pm EST
Can I set the range of a “named range” from the code behind with Spread.NET 10? or Spread.NET 12?
Posted 7 April 2019, 11:55 pm EST
I do want to clairify, I am trying to update a “named range” that is already set in a xls file that I am using as a template using Spread.NET 10.
Posted 9 April 2019, 11:15 pm EST
Hi,
Yes, you may set the named range from the code behind using addCustomName and get the named range using getCustomName method.
Please refer to the following documentation link for reference:
GetCustomName : http://help.grapecity.com/spread/SpreadNet12/ASP2/webframe.html#FarPoint.Web.Spread~FarPoint.Web.Spread.SheetView~GetCustomName.html
AddCustomName : http://help.grapecity.com/spread/SpreadNet12/ASP2/webframe.html#FarPoint.Web.Spread~FarPoint.Web.Spread.Model.ICustomNameSupport~AddCustomName.html
Regards,
Manish Gupta
Posted 10 April 2019, 12:46 am EST
What if I am trying to edit a named ranger that is already there from the template spreadsheet?
Posted 12 April 2019, 4:44 am EST
Hi,
For this, we need to add the custom name with the same name. For e.g suppose we have the NameRange with “Custom” name in excel file, we may change the name range using the following code:
((FarPoint.Web.Spread.Model.DefaultSheetDataModel)(FpSpread1.ActiveSheetView.DataModel)).AddCustomName("Custom", "$A$1:$C$1", 0, 0);
Hope it helps!
Regards,
Manish Gupta