'ExcelMapper C# set a column to be a hyperlink?

I'm using the ExcelMapper library https://github.com/mganss/ExcelMapper

However, I'm stuck on one part - I'm trying to set a cell value to be a hyperlink.

I've tried the following:

var data = new List<rows>();
-- Snip code
data.Row[0] = "=HYPERLINK(\"" + url.ActionLink("Action", "Controller", new { Id = obj.Id }) +"\")";

-- snip code

var ms = new MemoryStream();
            var excelMapper = new ExcelMapper();

            excelMapper.Saving += (s, e) =>
            {
                e.Sheet.AutoSizeColumn(0);

                e.Sheet.ForceFormulaRecalculation = true;
            };


            await excelMapper.SaveAsync(ms, data);

I was hoping the ForceFormulaRecalculation would make the formula calculate, but sadly not...

I've also decorated the property with [FormulaResult] as per here: https://github.com/mganss/ExcelMapper#map-formulas-or-results

Is there a way to set this up?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source