Excel file from Controller
Very easy way to create Excel quickly.... public void ExcelResults(int id) { Business.Agreement_Provider agr = new Business.Agreement_Provider(); List<MyModel> model = new List<MyModel>(); var agreements = agr.getExpiringAgreements(id); model = agreements.ToList(); model.OrderBy(p => p.My_Number); Export export = new Export(); export.ToExcel(Response, model); } Two methods - Call the first one from the page and then it uses the public Export class to return a file. The nice thing about the Export class is that we are passing our model in as an object - this allows us to reuse this same class for any model. public class Export { ...