/// <summary> /// Initialize a new instance of MSToolKit.Mvc.ExcelResult. /// </summary> /// <param name="data">The file's bytes to be attached to the current http response.</param> /// <param name="fileName">(optional)The name, that should be used for the attached file.</param> /// <param name="fileExtension">(optional)The extension, that should be used for the attached file.</param> public ExcelResult( IEnumerable <byte> data, Action <ExcelResultOptions> optionsExpression) { this.data = data; this.options = new ExcelResultOptions(); this.ApplyOptions(optionsExpression); }
public static ExcelResult Excel <T>( this ControllerBase controller, IEnumerable <IEnumerable <object> > data, Action <ExcelResultOptions> optionsExpression = default) where T : class { var options = new ExcelResultOptions(); if (optionsExpression != default) { optionsExpression(options); } var worksheetOptions = options as ExcelWorksheetOptions; return(new ExcelResult(data.ToExcelWorksheet(worksheetOptions), optionsExpression)); }