Search code examples
asp.net-coreepplus

Does EPPlus support MS Office Equations?


I am interested in using EPPlus for generating some xslx report files for a system. I'm interested in whether or not it is possible for EPPlus to tap into Excel's Equation's feature. This is different from formula's. I am aware of EPPlus's ability to add formula's and that's a great feature I am also using. The Equation feature in Excel prints out equations in a nice looking format and I am interested in using that in files I generate with EPPlus.

 public ActionResult OnPostDownloadExcelFile()
    {
        var ms = new MemoryStream();
        using (var package = new OfficeOpenXml.ExcelPackage(ms))
        {
            package.Workbook.Properties.Title = "Excel file with an equation in it";

            // Worksheet
            var worksheet = package.Workbook.Worksheets.Add("Report");
            worksheet.View.ShowGridLines = true;
            int row = 1;
            int col = 1;

            worksheet.Cells[row, col].Value = "I want to put an equation here...";
        }

        return File(ms, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "ExcelFileExample.xlsx");
    }

Solution

  • Unfortunately this is not supported in EPPlus. Equations are an embedded object. Embedded objects are not presently supported: https://github.com/JanKallman/EPPlus/wiki/FAQ#what-is-not-supported-by-the-library-these-are-the-most-obvious-features