Exemplo n.º 1
0
        public FileStreamResult GenerateExcelReport([Required, FromBody] ExcelReportRequest request)
        {
            byte[] file = ExcelLogic.ExecuteExcelReport(request.excelReport, request.queryRequest.ToQueryRequest());

            var fileName = request.excelReport.ToString() + "-" + TimeZoneManager.Now.ToString("yyyyMMdd-HHmmss") + ".xlsx";

            return(FilesController.GetFileStreamResult(new MemoryStream(file), fileName));
        }
Exemplo n.º 2
0
        public HttpResponseMessage GenerateExcelReport(ExcelReportRequest request)
        {
            byte[] file = ExcelLogic.ExecuteExcelReport(request.excelReport, request.queryRequest.ToQueryRequest());

            var fileName = request.excelReport.ToString() + "-" + TimeZoneManager.Now.ToString("yyyyMMdd-HHmmss") + ".xlsx";

            return(FilesController.GetHttpReponseMessage(new MemoryStream(file), fileName));
        }
Exemplo n.º 3
0
    public FileStreamResult GenerateExcelReport([Required, FromBody] ExcelReportRequest request)
    {
        byte[] file = ExcelLogic.ExecuteExcelReport(request.excelReport, request.queryRequest.ToQueryRequest(SignumServer.JsonSerializerOptions));

        var fileName = request.excelReport.ToString() + "-" + Clock.Now.ToString("yyyyMMdd-HHmmss") + ".xlsx";

        return(FilesController.GetFileStreamResult(new MemoryStream(file), fileName));
    }
Exemplo n.º 4
0
        public ActionResult ExcelReport(QueryRequest request, Lite <ExcelReportEntity> excelReport)
        {
            if (!Finder.IsFindable(request.QueryName))
            {
                throw new UnauthorizedAccessException(NormalControlMessage.ViewForType0IsNotAllowed.NiceToString().FormatWith(request.QueryName));
            }

            byte[] file = ExcelLogic.ExecuteExcelReport(excelReport, request);

            return(File(file, MimeMapping.GetMimeMapping(".xlsx"), Finder.ResolveWebQueryName(request.QueryName) + "-" + TimeZoneManager.Now.ToString("yyyyMMdd-HHmmss") + ".xlsx"));
            //Known Bug in IE: When the file dialog is shown, if Open is chosen the Excel will be broken as a result of IE automatically adding [1] to the name.
            //There's not workaround for this, so either click on Save instead of Open, or use Firefox or Chrome
        }