GetCustomName with Spread 11

Posted by: petri.rasanen on 12 April 2018, 9:18 pm EST

    • Post Options:
    • Link

    Posted 12 April 2018, 9:18 pm EST

    Hi

    How can I get a range of named area? In earlier versions it was easy like this:

    FarPoint.CalcEngine.Expression ext = Sheets[0].GetCustomName(areaName);

    I also tried to get custom names with GetCustomNameEnumerator, but was not able to get any names. Attached is excel file from where I tried to get custom names.

    Br,

    Petri

  • Posted 12 April 2018, 9:19 pm EST

    Attachment here.BW_Currencies.zip

  • Posted 16 April 2018, 1:59 am EST - Updated 30 September 2022, 5:18 am EST

    Hello,

    With Spread .NEt v11.0 latest , I used following code with your Excel file and got the Custom names defined for cells with no issues.

    
      fpSpread1.OpenExcel(@"C:\BW_Currencies.xlsx", FarPoint.Excel.ExcelOpenFlags.NoFlagsSet);
                System.Collections.IEnumerator se;
                se = fpSpread1.ActiveSheet.GetCustomNameEnumerator(false);
                listBox1.Items.AddRange(new Object[] { se.MoveNext().ToString(), se.Current.ToString(), se.MoveNext().ToString(), se.Current.ToString() });
    
    

    Please refer to the attached image.

    Thanks,

    Deepak Sharma

  • Posted 16 April 2018, 6:09 pm EST

    Thanks, but how can you get a range of on specific area?

    I have tried like this:

    FarPoint.CalcEngine.Expression customName = Sheets[0].GetCustomName(name, false);

    But the expression is type “{s0}”, not ExternalReferenceExpression or ReferenceExpression.

    Br,

    Petri

  • Posted 19 April 2018, 2:32 am EST

    Hi Petri,

    You are right, this is a known issue and will be fixed in our upcoming Serpice pack of Spread .NET v11.0.

    With the new build you will be able to use the code as follows:

    var expresion = fpSpread1.ActiveSheet.GetCustomName(“name”);

    GrapeCity.CalcEngine.IValue evaluatedValue;

    fpSpread1.ActiveSheet.EvaluateExpression(fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex, expresion, out evaluatedValue);

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels