We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Unrecognized SaveAsActionResult method.


I'm trying to use the following code snippet provided as sample to write data on Excel file.

        public ActionResult GenerateXLS(string SaveOption)
            if (SaveOption == null)
                return View();

            //New instance of XlsIO is created.[Equivalent to launching Microsoft Excel with no workbooks open].
            //The instantiation process consists of two steps.

            //Step 1 : Instantiate the spreadsheet creation engine.
            ExcelEngine excelEngine = new ExcelEngine();
            //Step 2 : Instantiate the excel application object.
            IApplication application = excelEngine.Excel;

            //A new workbook is created.[Equivalent to creating a new workbook in Microsoft Excel]
            //The new workbook will have 12 worksheets
            IWorkbook workbook = application.Workbooks.Open(DefaultResolveApplicationDataPath(@"QuotePreview.xls"));

            IWorksheet sheet = workbook.Worksheets[1];
            sheet.FirstVisibleRow = 3;

            IFont font = workbook.CreateFont();
            font.Bold = true;


                //Saving the workbook to disk.
                if (SaveOption == "Xls")
                    //Save as .xls format
                    return excelEngine.SaveAsActionResult(workbook, "Quote1.xls", HttpContext.ApplicationInstance.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel97);
                //Save as .xlsx format
                    workbook.Version = ExcelVersion.Excel2013;
                    return excelEngine.SaveAsActionResult(workbook, "Quote1.xlsx", HttpContext.ApplicationInstance.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel2013);
            catch (Exception)

            //Close the workbook.
            return View();

        private string DefaultResolveApplicationDataPath(string fileName)
            //string dataPath = string.Format("{0}\\Common\\Data\\XlsIO\\", Request.PhysicalPath.ToLower().Split(new string[] { "\\XlsIO" }, StringSplitOptions.None));
            //return string.Format("{0}\\{1}", dataPath, fileName);

            string folderName = "Data\\XlsIO";
            string dataPath = new System.IO.DirectoryInfo(Request.PhysicalPath + "..\\..\\..\\..\\..\\Common").FullName;
            if (folderName != string.Empty)
                dataPath += "\\" + folderName;
            return string.Format("{0}\\{1}", dataPath, fileName);

When I compile, I get the error message Unable to find method SaveAsActionResult for ExcelEngine object.
Must I define an extension as explained in http://help.syncfusion.com/file-formats/xlsio/asp-net-mvc?

Can you help me?


1 Reply

SS Sridhar Sukumar Syncfusion Team July 20, 2016 08:56 AM UTC

Hi Claudio, 
Thank you for contacting Syncfusion support. 
When I compile, I get the error message Unable to find method SaveAsActionResult for ExcelEngine object. 
Must I define an extension as explained in http://help.syncfusion.com/file-formats/xlsio/asp-net-mvc? 
Yes, you need to define an extension. 
We have prepared a simple sample for using XlsIO in ASP.NET MVC application which can be downloaded from the following link 
Alternative way: 
If you install Nuget package for ASP.NET MVC, then you no need to define the extension for those methods. The Nuget package for ASP.NET MVC can be downloaded from the following link: 
Download link: 
Sridhar S 

Live Chat Icon For mobile
Up arrow icon