This commit is contained in:
kamonwan taengsuk
2023-02-19 13:55:22 +07:00
parent c9d548b642
commit f8e4248d7f
2 changed files with 154 additions and 33 deletions

View File

@@ -146,6 +146,7 @@ namespace rmutr_report.Controllers
ws.Column(21).Width = 10;
ws.Column(22).Width = 10;
ws.Column(23).Width = 10;
ws.Columns().AdjustToContents();
ws.Column(1).Style.Font.FontName = "TH Sarabun New";
ws.Column(1).Style.Font.FontSize = 16;
ws.Column(2).Style.Font.FontName = "TH Sarabun New";
@@ -411,7 +412,62 @@ namespace rmutr_report.Controllers
ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A1:W1").Style.Fill.BackgroundColor = XLColor.Yellow;
}
if (a==17)
{
ws.Range("H2:X2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน";
ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("H2").Style.Font.FontName = "TH Sarabun New";
ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("X2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("X2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
ws.Range("H2:X2").Style.Border.TopBorder = XLBorderStyleValues.Thin;
ws.Range("A1:X1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ ประจำปีงบประมาณ พ.ศ. " + _kpi.budget_year;
ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A1:X1").Style.Fill.BackgroundColor = XLColor.Yellow;
}
if (a==18)
{
ws.Range("H2:Y2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน";
ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("H2").Style.Font.FontName = "TH Sarabun New";
ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("Y2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("Y2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
ws.Range("H2:Y2").Style.Border.TopBorder = XLBorderStyleValues.Thin;
ws.Range("A1:Y1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ ประจำปีงบประมาณ พ.ศ. " + _kpi.budget_year;
ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A1:Y1").Style.Fill.BackgroundColor = XLColor.Yellow;
}
if (a==19)
{
ws.Range("H2:Z2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน";
ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("H2").Style.Font.FontName = "TH Sarabun New";
ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("Z2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("Z2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
ws.Range("H2:Z2").Style.Border.TopBorder = XLBorderStyleValues.Thin;
ws.Range("A1:Z1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ ประจำปีงบประมาณ พ.ศ. " + _kpi.budget_year;
ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A1:Z1").Style.Fill.BackgroundColor = XLColor.Yellow;
}
if (a==20)
{
ws.Range("H2:AA2").Merge().Value = "แผนปี "+_kpi.plan_year.Substring(2, 2)+" หน่วยงาน";
ws.Cell("H2").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell("H2").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell("H2").Style.Font.FontName = "TH Sarabun New";
ws.Cell("H2").Style.Font.SetBold().Font.FontSize = 16;
ws.Cell("AA2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Cell("AA2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
ws.Range("H2:AA2").Style.Border.TopBorder = XLBorderStyleValues.Thin;
ws.Range("A1:AA1").Merge().Value = "แจ้งรายละเอียดตัวชี้วัดแผนกลยุทธ์ ประจำปีงบประมาณ พ.ศ. " + _kpi.budget_year;
ws.Cell("A1").Style.Font.SetBold().Font.FontSize = 16;
ws.Range("A1:AA1").Style.Fill.BackgroundColor = XLColor.Yellow;
}
}
foreach (var header in _kpi.header_data)
@@ -558,7 +614,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 15)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==10)
@@ -574,7 +630,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 16)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==11)
@@ -590,7 +646,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 17)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==12)
@@ -606,7 +662,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 18)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==13)
@@ -622,7 +678,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 19)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==14)
@@ -638,7 +694,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 20)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==15)
@@ -654,7 +710,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 21)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==16)
@@ -670,7 +726,71 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 22)).Merge().Style.Fill.BackgroundColor =
ws.Range(ws.Cell(row, 1), ws.Cell(row, 23)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==17)
{
ws.Range("A4:X4").Merge().Value = "ตัวชี้วัดแผนกลยุทธ์ พ.ศ. " + header.year_range;
ws.Cell("A4").Style.Font.Bold = true;
ws.Cell("A4").Style.Alignment.WrapText = true;
ws.Range("A4:X4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A4:X4").Style.Fill.BackgroundColor = XLColor.PurpleX11;
ws.Range("X4:X5").Style.Border.RightBorder = XLBorderStyleValues.Thin;
string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues;
no++;
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 24)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==18)
{
ws.Range("A4:Y4").Merge().Value = "ตัวชี้วัดแผนกลยุทธ์ พ.ศ. " + header.year_range;
ws.Cell("A4").Style.Font.Bold = true;
ws.Cell("A4").Style.Alignment.WrapText = true;
ws.Range("A4:Y4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A4:Y4").Style.Fill.BackgroundColor = XLColor.PurpleX11;
ws.Range("X4:Y5").Style.Border.RightBorder = XLBorderStyleValues.Thin;
string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues;
no++;
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 25)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==19)
{
ws.Range("A4:Z4").Merge().Value = "ตัวชี้วัดแผนกลยุทธ์ พ.ศ. " + header.year_range;
ws.Cell("A4").Style.Font.Bold = true;
ws.Cell("A4").Style.Alignment.WrapText = true;
ws.Range("A4:Z4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A4:Z4").Style.Fill.BackgroundColor = XLColor.PurpleX11;
ws.Range("X4:Z5").Style.Border.RightBorder = XLBorderStyleValues.Thin;
string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues;
no++;
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 26)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
if (a==20)
{
ws.Range("A4:AA4").Merge().Value = "ตัวชี้วัดแผนกลยุทธ์ พ.ศ. " + header.year_range;
ws.Cell("A4").Style.Font.Bold = true;
ws.Cell("A4").Style.Alignment.WrapText = true;
ws.Range("A4:AA4").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range("A4:AA4").Style.Fill.BackgroundColor = XLColor.PurpleX11;
ws.Range("X4:AA5").Style.Border.RightBorder = XLBorderStyleValues.Thin;
string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " " + header.strategic_issues;
no++;
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
ws.Cell(row, 1).Style.Border.OutsideBorder =
XLBorderStyleValues.None;
ws.Range(ws.Cell(row, 1), ws.Cell(row, 27)).Merge().Style.Fill.BackgroundColor =
XLColor.BlizzardBlue;
}
// ws.Range("A4:W4").Merge().Value = "ตัวชี้วัดแผนกลยุทธ์ พ.ศ. " + header.year_range;
@@ -689,7 +809,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
ws.Cell(row, 23).Style.Border.RightBorder = XLBorderStyleValues.Thin;
//ws.Cell(row, 23).Style.Border.RightBorder = XLBorderStyleValues.Thin;
row++;
//var dataagency2 = _kpi.agencys.Where(d => d.agency_name==d.agency_name).ToList();
foreach (var data1 in header.data)
@@ -758,10 +878,10 @@ namespace rmutr_report.Controllers
// ws.Cell(row, 21).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 22).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
// ws.Cell(row, 23).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1),ws.Cell(row,27)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Font.FontName = "TH Sarabun New";
ws.Range(ws.Cell(row, 1),ws.Cell(row,23)).Style.Font.FontSize = 16;
ws.Range(ws.Cell(row, 1),ws.Cell(row,27)).Style.Font.FontName = "TH Sarabun New";
ws.Range(ws.Cell(row, 1),ws.Cell(row,27)).Style.Font.FontSize = 16;
row++;
rowno++;