From c2bd91542e06a76d733c27d7d3fb8eebf40852f5 Mon Sep 17 00:00:00 2001 From: kamonwan taengsuk Date: Thu, 3 Nov 2022 14:05:34 +0700 Subject: [PATCH] move file --- Controllers/KPI.Controller.cs | 5 +++ Controllers/Summary.Controller.cs | 32 ++++++++++++------- Models/{ => budget}/budget_report.cs | 0 Models/{ => budget}/kpi.cs | 0 Models/{ => budget}/statement_of_equipment.cs | 0 .../summary_building_construction.cs | 0 Models/{ => budget}/summary_of_equipment.cs | 0 .../summary_of_equipment_five_year.cs | 0 rmutr-report.csproj | 3 ++ 9 files changed, 28 insertions(+), 12 deletions(-) rename Models/{ => budget}/budget_report.cs (100%) rename Models/{ => budget}/kpi.cs (100%) rename Models/{ => budget}/statement_of_equipment.cs (100%) rename Models/{ => budget}/summary_building_construction.cs (100%) rename Models/{ => budget}/summary_of_equipment.cs (100%) rename Models/{ => budget}/summary_of_equipment_five_year.cs (100%) diff --git a/Controllers/KPI.Controller.cs b/Controllers/KPI.Controller.cs index 1f08427..7171439 100644 --- a/Controllers/KPI.Controller.cs +++ b/Controllers/KPI.Controller.cs @@ -176,6 +176,11 @@ namespace rmutr_report.Controllers foreach (var data1 in header.data) { + if ( rowno > 1 ) + { + ws.Range(ws.Cell(row, 1), ws.Cell(row,1)).Merge(); + + } ws.Cell(row, 2).Value = rowno; ws.Cell(row, 3).Value = data1.name; ws.Cell(row, 4).Value = data1.unit; diff --git a/Controllers/Summary.Controller.cs b/Controllers/Summary.Controller.cs index 98baab7..de26000 100644 --- a/Controllers/Summary.Controller.cs +++ b/Controllers/Summary.Controller.cs @@ -275,19 +275,27 @@ namespace rmutr_report.Controllers stream.Seek(0, SeekOrigin.Begin); return File(stream, "text/csv"); break; + case "xlsx": case "xls": + workbook.SaveAs(stream); + var content = stream.ToArray(); + string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + return File( + content, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "equipments_" + date + ".xlsx"); } - - using (var stream1 = new MemoryStream()) - { - workbook.SaveAs(stream1); - var content = stream1.ToArray(); - string date = DateTime.Now.ToString("yyyyMMddHHmmss"); - return File( - content, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - "equipments_" + date + ".xlsx"); - } - // return Ok(); + + // using (var stream1 = new MemoryStream()) + // { + // workbook.SaveAs(stream1); + // var content = stream1.ToArray(); + // string date = DateTime.Now.ToString("yyyyMMddHHmmss"); + // return File( + // content, + // "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + // "equipments_" + date + ".xlsx"); + // } + return Ok(); } diff --git a/Models/budget_report.cs b/Models/budget/budget_report.cs similarity index 100% rename from Models/budget_report.cs rename to Models/budget/budget_report.cs diff --git a/Models/kpi.cs b/Models/budget/kpi.cs similarity index 100% rename from Models/kpi.cs rename to Models/budget/kpi.cs diff --git a/Models/statement_of_equipment.cs b/Models/budget/statement_of_equipment.cs similarity index 100% rename from Models/statement_of_equipment.cs rename to Models/budget/statement_of_equipment.cs diff --git a/Models/summary_building_construction.cs b/Models/budget/summary_building_construction.cs similarity index 100% rename from Models/summary_building_construction.cs rename to Models/budget/summary_building_construction.cs diff --git a/Models/summary_of_equipment.cs b/Models/budget/summary_of_equipment.cs similarity index 100% rename from Models/summary_of_equipment.cs rename to Models/budget/summary_of_equipment.cs diff --git a/Models/summary_of_equipment_five_year.cs b/Models/budget/summary_of_equipment_five_year.cs similarity index 100% rename from Models/summary_of_equipment_five_year.cs rename to Models/budget/summary_of_equipment_five_year.cs diff --git a/rmutr-report.csproj b/rmutr-report.csproj index 2c4908b..fc57ff1 100644 --- a/rmutr-report.csproj +++ b/rmutr-report.csproj @@ -16,5 +16,8 @@ + + +