PFA workbook.
Example code:
public class UdfManager : AbstractCalculationEngine
{
public override void Calculate(CalculationData data)
{
if (data.FunctionName.Equals("DCRefersToSheetName"))
{
data.CalculatedValue = "Inputs";
}
}
}
static void Main(string[] args)
{
var workbook = new Workbook(@"udfs.xlsx");
var manager = new UdfManager();
var options = new CalculationOptions
{
IgnoreError = true,
PrecisionStrategy = CalculationPrecisionStrategy.Decimal,
CustomEngine = manager
};
var sheet = workbook.Worksheets["hides"];
workbook.CalculateFormula(options);
var beforeA2 = sheet.Cells["A2"].Value;
var beforeB5 = sheet.Cells["B5"].Value;
workbook.RefreshDynamicArrayFormulas(true);
var afterA2 = sheet.Cells["A2"].Value;
var afterB5 = sheet.Cells["B5"].Value;
}
udfs.zip (11.8 KB)