public FileContentResult Export(string application, [FromUri] ApplicationMetadataSchemaKey key, [FromUri] PaginatedSearchRequestDto searchDTO, string module) { searchDTO.PageSize = searchDTO.TotalCount + 1; if (module != null) { _contextLookuper.LookupContext().Module = module; } var before = Stopwatch.StartNew(); var before2 = Stopwatch.StartNew(); var user = SecurityFacade.CurrentUser(); var applicationMetadata = MetadataProvider .Application(application) .ApplyPolicies(key, user, ClientPlatform.Web); var dataResponse = _dataController.Get(application, new DataRequestAdapter { Key = key, SearchDTO = searchDTO }); Log.Debug(LoggingUtil.BaseDurationMessageFormat(before, "finished gathering export excel data")); var excelBytes = _excelUtil.ConvertGridToExcel(user, applicationMetadata.Schema, ((ApplicationListResult)dataResponse).ResultObject); Log.Info(LoggingUtil.BaseDurationMessageFormat(before2, "finished export excel data")); var fileName = GetFileName(application, key.SchemaId) + ".xls"; var result = new FileContentResult(excelBytes, System.Net.Mime.MediaTypeNames.Application.Octet) { FileDownloadName = (string)StringUtil.FirstLetterToUpper(fileName) }; return(result); }