[後台][後端] 水電報表 Export 匯出報表 api 部分程序調整
This commit is contained in:
		
							parent
							
								
									5e45a6cca4
								
							
						
					
					
						commit
						4e0b457bbe
					
				@ -452,14 +452,15 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            workbook.Write(ms);
 | 
					            workbook.Write(ms);
 | 
				
			||||||
            ms.Flush();
 | 
					            ms.Flush();
 | 
				
			||||||
            ms.Seek(0, SeekOrigin.Begin);
 | 
					            ms.Seek(0, SeekOrigin.Begin);
 | 
				
			||||||
 | 
					            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
 | 
				
			||||||
            return File(ms, "application/vnd.ms-excel", "電表報表.xlsx");
 | 
					            return File(ms, "application/vnd.ms-excel", "電表報表.xlsx");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [HttpGet]
 | 
					        [HttpPost]
 | 
				
			||||||
        [Route("api/ExportWaterList")]
 | 
					        [Route("api/ExportWaterList")]
 | 
				
			||||||
        public FileResult OpeExportExcelWater([FromBody] HydroMeterInput input)
 | 
					        public FileResult OpeExportExcelWater([FromBody] HydroMeterInput input)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            var result = this.WaterList(input).Result.Value.Data.ToList();
 | 
					            var result = this.WaterList(input).Result.Value.Data.ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var workbook = new XSSFWorkbook();
 | 
					            var workbook = new XSSFWorkbook();
 | 
				
			||||||
@ -602,6 +603,8 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            ms.Flush();
 | 
					            ms.Flush();
 | 
				
			||||||
            ms.Seek(0, SeekOrigin.Begin);
 | 
					            ms.Seek(0, SeekOrigin.Begin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return File(ms, "application/vnd.ms-excel", "水表報表.xlsx");
 | 
					            return File(ms, "application/vnd.ms-excel", "水表報表.xlsx");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -68,7 +68,8 @@ namespace FrontendWebApi
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    policy.AllowAnyOrigin()
 | 
					                    policy.AllowAnyOrigin()
 | 
				
			||||||
                          .AllowAnyHeader()
 | 
					                          .AllowAnyHeader()
 | 
				
			||||||
                          .AllowAnyMethod();
 | 
					                          .AllowAnyMethod()
 | 
				
			||||||
 | 
					                          .WithExposedHeaders("Content-Disposition");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            services.AddLogging(
 | 
					            services.AddLogging(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user