Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first PR for NPOI, and I'm still very much a newbie when it comes to the codebase. But this was a function that we needed, and it seemed like this was the easiest way to get it done.
Please let me know if there's anything I could/should be doing differently or better, or if there's anything I missed.
Copilot Description
This pull request introduces changes to the codebase to implement the Excel FORECAST function in the
NPOI.SS.Formula.Functions
namespace. The most significant changes include the addition of theForecast
class, a modification to theProduceFunctions
method in theFunctionEval
class to use this newForecast
class, and the addition of unit tests to verify the functionality of theForecast
class.Here are the top five most important changes:
Codebase expansion:
main/SS/Formula/Functions/Forecast.cs
: Added theForecast
class which represents the Excel FORECAST function. This function predicts a future value along a linear trend line based on existing historical data. The class includes methods for convertingValueEval
objects to numeric arrays and for creatingValueVectors
.Codebase modification:
main/SS/Formula/Eval/FunctionEval.cs
: Modified theProduceFunctions
method to use the newForecast
class instead of theNotImplementedFunction
for the FORECAST function.Codebase configuration:
build/_build.csproj.DotSettings
: Added user rules for C# naming conventions and updated the settings migration to reflect these changes. [1] [2]Testing:
testcases/main/SS/Formula/Functions/TestForecast.cs
: Added a new test classTestForecast
for theForecast
function. This class includes tests for basic functionality, handling of large numbers and arrays, error propagation, and a test replicating an example from the Microsoft support website.