[]
Represents an area in a spreadsheet.
A CalcReference encapsulates one or more worksheet ranges that are
used as a calculation reference. You can use this class to inspect whether the
reference spans multiple areas, refers to another workbook, or represents a
3D reference, and to retrieve the referenced IRange objects or their
values.
public class CalcReference
Public Class CalcReference
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();
}
}
| Name | Description |
|---|---|
| Is3DReference | Gets whether the reference is a 3D reference. |
| IsExternalReference | Gets whether the reference is in another workbook. |
| RangeCount | Gets the count of the ranges in current area. |
| Name | Description |
|---|---|
| GetRanges() | Gets all referenced ranges. |
| 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 |