Features

Custom Function

Custom Function

FlexSheet allows user to add custom functions by the client addFunction method.

Features

Custom Function

FlexSheet allows user to add custom functions by the client addFunction method.
FlexSheet will parse the cell reference parameter such as 'A1' or 'A1:B2' to a CellRange instance for the custom function.

FlexSheet also allows user to process non-supported functions met in cell expressions by the client unknownFuntion event.
This event will pass the 'UnKnownFunctionEventArgs' to customer. This 'UnKnownFunctionEventArgs' provides the function name and the evaluated values list of the parameters.
User can set the 'value' field of 'UnKnownFunctionEventArgs' to customize the missed formula result.
Otherwise the missed function will return the default error message: 'The function "funcName" is not supported in FlexSheet yet.'.

using Microsoft.AspNetCore.Mvc;

namespace FlexSheetExplorer.Controllers
{
    public partial class FlexSheetController : Controller
    {
        public ActionResult CustomFunction()
        {
            return View();
        }
    }
}
@section Scripts{<script src="~/Scripts/flexSheet/customFunction.js"></script>}
<div>
    <div class="copy">
        <h3>
            @Html.Raw(FlexSheetRes.CustomFunction_Text3)
        </h3>
<p>@Html.Raw(FlexSheetRes.CustomFunction_Text0)</p>

<p>@Html.Raw(FlexSheetRes.CustomFunction_Text1)</p>

    </div>
    <div>
        <c1-flex-sheet id="customFuncSheet" class="flexSheet"
                       unknown-function="unknownFunction">
            <c1-unbound-sheet row-count="25" column-count="12"></c1-unbound-sheet>
        </c1-flex-sheet>
    </div>
</div>
@section Summary{
<p>@Html.Raw(FlexSheetRes.CustomFunction_Text2)</p>

}