// Hook: BeforeCalculation // Halt the job if a required named range is missing. // // Some templates rely on a named range (here "InputData") existing for // formulas to resolve. If the data preparation step didn't run, the range // won't exist and the report will silently produce wrong numbers - so we // stop the job with a clear message instead. var namedRange = Workbook.Worksheets.GetNamedRanges() .FirstOrDefault(r => r.Name == "InputData"); if (namedRange == null) { AddError("Named range 'InputData' is missing from the workbook. Ensure the data preparation step has completed before this job runs."); } Logger.LogInformation("Named range 'InputData' found - proceeding with calculation.");