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