[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.CalcReference.GetValues

GetValues Method

GetValues()

Gets the values of all ranges in this reference.

Use this method in custom-function evaluation logic to retrieve the values represented by a CalcReference argument.

Declaration
public object GetValues()
Public Function GetValues() As Object
Returns
Type Description
object

An object that contains the values of all referenced ranges.

Examples
CustomFunction function = new RefValuesFunction();
Workbook.AddCustomFunction(function, true);
worksheet.Range["A1:B2"].Value = new object[,] {{1, 2}, {3, 4}};
worksheet.Range["C1"].Formula2 = "=REFVALUES(A1:B2)";
object values = worksheet.Range["C1:D2"].Value;

class RefValuesFunction : CustomFunction
{
    public RefValuesFunction()
        : base("REFVALUES", FunctionValueType.Object, new Parameter[] { new Parameter(FunctionValueType.Object, true, false) })
    {
    }

    public override object Evaluate(object[] arguments, ICalcContext context)
    {
        CalcReference reference = (CalcReference)arguments[0];
        return reference.GetValues();
    }
}