[]
Gets the row index of the cell which is calculating.
Use this property in a custom function to identify the zero-based row position of the cell whose formula is currently being evaluated.
int Row { get; }
ReadOnly Property Row As Integer
CustomFunction function = new CaptureRowFunction();
Workbook.AddCustomFunction(function, true);
worksheet.Range["C3"].Formula = "=CAPTUREROW()";
object row = worksheet.Range["C3"].Value;
class CaptureRowFunction : CustomFunction
{
public CaptureRowFunction()
: base("CAPTUREROW", FunctionValueType.Number)
{
}
public override object Evaluate(object[] arguments, ICalcContext context)
{
int row = context.Row;
return (double)row;
}
}