diff --git a/FrontendWebApi/ApiControllers/HydroMeterController.cs b/FrontendWebApi/ApiControllers/HydroMeterController.cs index 281bfd0..293ae3b 100644 --- a/FrontendWebApi/ApiControllers/HydroMeterController.cs +++ b/FrontendWebApi/ApiControllers/HydroMeterController.cs @@ -452,14 +452,15 @@ namespace FrontendWebApi.ApiControllers workbook.Write(ms); ms.Flush(); ms.Seek(0, SeekOrigin.Begin); - + Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); return File(ms, "application/vnd.ms-excel", "電表報表.xlsx"); } - [HttpGet] + [HttpPost] [Route("api/ExportWaterList")] public FileResult OpeExportExcelWater([FromBody] HydroMeterInput input) { + var result = this.WaterList(input).Result.Value.Data.ToList(); var workbook = new XSSFWorkbook(); @@ -602,6 +603,8 @@ namespace FrontendWebApi.ApiControllers ms.Flush(); ms.Seek(0, SeekOrigin.Begin); + Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); + return File(ms, "application/vnd.ms-excel", "水表報表.xlsx"); } } diff --git a/FrontendWebApi/Startup.cs b/FrontendWebApi/Startup.cs index 956d4d8..1d8079f 100644 --- a/FrontendWebApi/Startup.cs +++ b/FrontendWebApi/Startup.cs @@ -68,7 +68,8 @@ namespace FrontendWebApi { policy.AllowAnyOrigin() .AllowAnyHeader() - .AllowAnyMethod(); + .AllowAnyMethod() + .WithExposedHeaders("Content-Disposition"); }); }); services.AddLogging(