787 lines
51 KiB
C#
787 lines
51 KiB
C#
using System;
|
|
using System.IO;
|
|
using ClosedXML.Excel;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using rmutr_report.Models;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
|
|
namespace rmutr_report.Controllers
|
|
{
|
|
[SwaggerTag("สำหรับรายงานจำนวนนักศึกษาทั้งหมด แยกเขตพื้นที่")]
|
|
public class StudentTotalCampus : Controller
|
|
{
|
|
readonly Setting _setting;
|
|
|
|
public StudentTotalCampus(Setting setting)
|
|
{
|
|
_setting = setting;
|
|
}
|
|
|
|
[HttpPost, Route("reports/student_total_campus/{type}")]
|
|
[ApiExplorerSettings(GroupName = "reports")]
|
|
public IActionResult GetDetailStdReport([FromRoute] string type, [FromBody] student_totalcampus _std)
|
|
{
|
|
var workbook = new XLWorkbook();
|
|
var ws = workbook.Worksheets.Add("student_total_campus");
|
|
ws.Range("A1:AD1").Merge().Value = "จำนวนนักศึกษาทั้งหมด ปีการศึกษา " + _std.academic_year_name_th +
|
|
" ภาคการศึกษาที่ " + _std.academic_semester_name_th +
|
|
" มหาวิทยาลัยเทคโนโลยีราชมงคลรัตนโกสินทร์";
|
|
ws.Cell("A1").Style.Font.Bold = true;
|
|
ws.Cell("A1").Style.Alignment.WrapText = true;
|
|
ws.Cell("A1").Style.Font.FontName = "TH Sarabun New";
|
|
ws.Cell("A1").Style.Font.FontSize = 16;
|
|
ws.Range("A1:AD1").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A1:AD1").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("A2:B3").Merge().Value = "คณะ/วิทยาลัย - สาขาวิชา";
|
|
ws.Range("A2:B3").Style.Font.Bold = true;
|
|
ws.Range("A2:B3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("A2:B3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("C2:F2").Merge().Value = "ชั้นปีที่ 1 " + "(" + _std.admit_year1 + ")";
|
|
ws.Range("C2:F2").Style.Font.Bold = true;
|
|
ws.Range("C2:F2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("C2:F2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("C3").Value = "ชาย";
|
|
ws.Cell("D3").Value = "หญิง";
|
|
ws.Cell("E3").Value = "รวม";
|
|
ws.Cell("F3").Value = "จำนวนห้อง";
|
|
ws.Range("G2:J2").Merge().Value = "ชั้นปีที่ 2 " + "(" + _std.admit_year2 + ")";
|
|
ws.Range("G2:J2").Style.Font.Bold = true;
|
|
ws.Range("G2:J2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G2:J2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
//ws.Range("G2:J2").Style.Fill.BackgroundColor = XLColor.LavenderBlush;
|
|
ws.Cell("G3").Value = "ชาย";
|
|
ws.Cell("H3").Value = "หญิง";
|
|
ws.Cell("I3").Value = "รวม";
|
|
ws.Cell("J3").Value = "จำนวนห้อง";
|
|
ws.Range("K2:N2").Merge().Value = "ชั้นปีที่ 3 " + "(" + _std.admit_year3 + ")";
|
|
ws.Range("K2:N2").Style.Font.Bold = true;
|
|
ws.Range("K2:N2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("K2:N2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
//ws.Range("K2:N2").Style.Fill.BackgroundColor = XLColor.LavenderBlush;
|
|
ws.Cell("K3").Value = "ชาย";
|
|
ws.Cell("L3").Value = "หญิง";
|
|
ws.Cell("M3").Value = "รวม";
|
|
ws.Cell("N3").Value = "จำนวนห้อง";
|
|
ws.Range("O2:R2").Merge().Value = "ชั้นปีที่ 4 " + "(" + _std.admit_year4 + ")";
|
|
ws.Range("O2:R2").Style.Font.Bold = true;
|
|
ws.Range("O2:R2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("O2:R2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("O3").Value = "ชาย";
|
|
ws.Cell("P3").Value = "หญิง";
|
|
ws.Cell("Q3").Value = "รวม";
|
|
ws.Cell("R3").Value = "จำนวนห้อง";
|
|
ws.Range("S2:V2").Merge().Value = "ชั้นปีที่ 5 " + "(" + _std.admit_year5 + ")";
|
|
ws.Range("S2:V2").Style.Font.Bold = true;
|
|
ws.Range("S2:V2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("S2:V2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("S3").Value = "ชาย";
|
|
ws.Cell("T3").Value = "หญิง";
|
|
ws.Cell("U3").Value = "รวม";
|
|
ws.Cell("V3").Value = "จำนวนห้อง";
|
|
ws.Range("W2:Z2").Merge().Value = "นักศึกษาตกรุ่น/>ชั้นปีที่ 5";
|
|
ws.Range("W2:Z2").Style.Font.Bold = true;
|
|
ws.Range("W2:Z2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("W2:Z2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("W3").Value = "ชาย";
|
|
ws.Cell("X3").Value = "หญิง";
|
|
ws.Cell("Y3").Value = "รวม";
|
|
ws.Cell("Z3").Value = "จำนวนห้อง";
|
|
ws.Range("AA2:AD2").Merge().Value = "รวม";
|
|
ws.Range("AA2:AD2").Style.Font.Bold = true;
|
|
ws.Range("AA2:AD2").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("AA2:AD2").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Cell("AA3").Value = "ชาย";
|
|
ws.Cell("AB3").Value = "หญิง";
|
|
ws.Cell("AC3").Value = "รวม";
|
|
ws.Cell("AD3").Value = "จำนวนห้อง";
|
|
ws.Range("A2:AD3").Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range("A2:AD3").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Range("C3:AD3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("C3:F3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("G3:J3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("K3:N3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("O3:R3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("S3:V3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("W3:Z3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("AA3:AD3").Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
ws.Range("AD3").Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Row(1).AdjustToContents();
|
|
ws.Column(1).Width = 5;
|
|
ws.Column(2).Width = 30;
|
|
ws.Column(3).Width = 10;
|
|
ws.Column(4).Width = 10;
|
|
ws.Column(5).Width = 10;
|
|
ws.Column(6).Width = 10;
|
|
ws.Column(7).Width = 10;
|
|
ws.Column(8).Width = 10;
|
|
ws.Column(9).Width = 10;
|
|
ws.Column(10).Width = 10;
|
|
ws.Column(11).Width = 10;
|
|
ws.Column(12).Width = 10;
|
|
ws.Column(13).Width = 10;
|
|
ws.Column(15).Width = 10;
|
|
ws.Column(16).Width = 10;
|
|
ws.Column(17).Width = 10;
|
|
ws.Column(18).Width = 10;
|
|
ws.Column(19).Width = 10;
|
|
ws.Column(20).Width = 10;
|
|
ws.Column(21).Width = 10;
|
|
ws.Column(22).Width = 10;
|
|
ws.Column(23).Width = 10;
|
|
ws.Column(24).Width = 10;
|
|
ws.Column(25).Width = 10;
|
|
ws.Column(26).Width = 10;
|
|
ws.Column(27).Width = 10;
|
|
ws.Range("A2:AD3").Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range("A2:AD3").Style.Font.FontSize = 16;
|
|
ws.Range("A2:AD3").Style.Fill.BackgroundColor =
|
|
XLColor.Bisque;
|
|
int row = 4;
|
|
int no = 1;
|
|
int rowno = 1;
|
|
if (_std != null)
|
|
{
|
|
foreach (var header in _std.header_data)
|
|
{
|
|
decimal? sum1 = header.male1 + header.female1;
|
|
decimal? sum2 = header.male2 + header.female2;
|
|
decimal? sum3 = header.male3 + header.female3;
|
|
decimal? sum4 = header.male4 + header.female4;
|
|
decimal? sum5 = header.male5 + header.female5;
|
|
decimal? sum6 = header.male6 + header.female6;
|
|
|
|
decimal? sumroom = header.room1 + header.room2 +header.room3 + header.room4 +header.room5 + header.room6;
|
|
|
|
|
|
if (header.filter == 1)
|
|
{
|
|
ws.Cell(row, 1).Value = header.header_name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = header.male1;
|
|
ws.Cell(row, 4).Value = header.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = header.room1;
|
|
ws.Cell(row, 7).Value = header.male2;
|
|
ws.Cell(row, 8).Value = header.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = header.room2;
|
|
ws.Cell(row, 11).Value = header.male3;
|
|
ws.Cell(row, 12).Value = header.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = header.room3;
|
|
ws.Cell(row, 15).Value = header.male4;
|
|
ws.Cell(row, 16).Value = header.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = header.room4;
|
|
ws.Cell(row, 19).Value = header.male5;
|
|
ws.Cell(row, 20).Value = header.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = header.room5;
|
|
ws.Cell(row, 23).Value = header.male6;
|
|
ws.Cell(row, 24).Value = header.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = header.room6;
|
|
ws.Cell(row, 27).Value = header.male7;
|
|
ws.Cell(row, 28).Value = header.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.Bold = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor =
|
|
XLColor.ColumbiaBlue;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.ColumbiaBlue;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.filter == (decimal?) 1.1)
|
|
{
|
|
foreach (var detail in header.data)
|
|
{
|
|
ws.Cell(row, 1).Value = rowno;
|
|
ws.Cell(row, 2).Value = detail.name;
|
|
ws.Cell(row, 3).Value = detail.male1;
|
|
ws.Cell(row, 4).Value = detail.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = detail.room1;
|
|
ws.Cell(row, 7).Value = detail.male2;
|
|
ws.Cell(row, 8).Value = detail.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = detail.room2;
|
|
ws.Cell(row, 11).Value = detail.male3;
|
|
ws.Cell(row, 12).Value = detail.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = detail.room3;
|
|
ws.Cell(row, 15).Value = detail.male4;
|
|
ws.Cell(row, 16).Value = detail.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = detail.room4;
|
|
ws.Cell(row, 19).Value = detail.male5;
|
|
ws.Cell(row, 20).Value = detail.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = detail.room5;
|
|
ws.Cell(row, 23).Value = detail.male6;
|
|
ws.Cell(row, 24).Value = detail.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = detail.room6;
|
|
ws.Cell(row, 27).Value = detail.male7;
|
|
ws.Cell(row, 28).Value = detail.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
rowno++;
|
|
row++;
|
|
}
|
|
}
|
|
|
|
if (header.filter == 2)
|
|
{
|
|
ws.Cell(row, 1).Value = header.header_name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = header.male1;
|
|
ws.Cell(row, 4).Value = header.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = header.room1;
|
|
ws.Cell(row, 7).Value = header.male2;
|
|
ws.Cell(row, 8).Value = header.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = header.room2;
|
|
ws.Cell(row, 11).Value = header.male3;
|
|
ws.Cell(row, 12).Value = header.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = header.room3;
|
|
ws.Cell(row, 15).Value = header.male4;
|
|
ws.Cell(row, 16).Value = header.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = header.room4;
|
|
ws.Cell(row, 19).Value = header.male5;
|
|
ws.Cell(row, 20).Value = header.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = header.room5;
|
|
ws.Cell(row, 23).Value = header.male6;
|
|
ws.Cell(row, 24).Value = header.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = header.room6;
|
|
ws.Cell(row, 27).Value = header.male7;
|
|
ws.Cell(row, 28).Value = header.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.Bold = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor =
|
|
XLColor.CadmiumYellow;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.CadmiumYellow;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.filter == 3)
|
|
{
|
|
ws.Cell(row, 1).Value = header.header_name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = header.male1;
|
|
ws.Cell(row, 4).Value = header.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = header.room1;
|
|
ws.Cell(row, 7).Value = header.male2;
|
|
ws.Cell(row, 8).Value = header.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = header.room2;
|
|
ws.Cell(row, 11).Value = header.male3;
|
|
ws.Cell(row, 12).Value = header.female3;
|
|
ws.Cell(row, 13).Value = header.total3;
|
|
ws.Cell(row, 14).Value = sum3;
|
|
ws.Cell(row, 15).Value = header.male4;
|
|
ws.Cell(row, 16).Value = header.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = header.room4;
|
|
ws.Cell(row, 19).Value = header.male5;
|
|
ws.Cell(row, 20).Value = header.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = header.room5;
|
|
ws.Cell(row, 23).Value = header.male6;
|
|
ws.Cell(row, 24).Value = header.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = header.room6;
|
|
ws.Cell(row, 27).Value = header.male7;
|
|
ws.Cell(row, 28).Value = header.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.Bold = true;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor =
|
|
XLColor.MintGreen;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.MintGreen;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.filter == 4)
|
|
{
|
|
ws.Cell(row, 1).Value = header.header_name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = header.male1;
|
|
ws.Cell(row, 4).Value = header.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = header.room1;
|
|
ws.Cell(row, 7).Value = header.male2;
|
|
ws.Cell(row, 8).Value = header.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = header.room2;
|
|
ws.Cell(row, 11).Value = header.male3;
|
|
ws.Cell(row, 12).Value = header.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = header.room3;
|
|
ws.Cell(row, 15).Value = header.male4;
|
|
ws.Cell(row, 16).Value = header.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = header.room4;
|
|
ws.Cell(row, 19).Value = header.male5;
|
|
ws.Cell(row, 20).Value = header.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = header.room5;
|
|
ws.Cell(row, 23).Value = header.male6;
|
|
ws.Cell(row, 24).Value = header.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = header.room6;
|
|
ws.Cell(row, 27).Value = header.male7;
|
|
ws.Cell(row, 28).Value = header.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor = XLColor.BabyBlue;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.BabyBlue;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
if (header.filter == (decimal?) 4.1)
|
|
{
|
|
foreach (var detail in header.data)
|
|
{
|
|
ws.Cell(row, 1).Value = rowno;
|
|
ws.Cell(row, 2).Value = detail.name;
|
|
ws.Cell(row, 3).Value = detail.male1;
|
|
ws.Cell(row, 4).Value = detail.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = detail.room1;
|
|
ws.Cell(row, 7).Value = detail.male2;
|
|
ws.Cell(row, 8).Value = detail.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = detail.room2;
|
|
ws.Cell(row, 11).Value = detail.male3;
|
|
ws.Cell(row, 12).Value = detail.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = detail.room3;
|
|
ws.Cell(row, 15).Value = detail.male4;
|
|
ws.Cell(row, 16).Value = detail.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = detail.room4;
|
|
ws.Cell(row, 19).Value = detail.male5;
|
|
ws.Cell(row, 20).Value = detail.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = detail.room5;
|
|
ws.Cell(row, 23).Value = detail.male6;
|
|
ws.Cell(row, 24).Value = detail.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = detail.room6;
|
|
ws.Cell(row, 27).Value = detail.male7;
|
|
ws.Cell(row, 28).Value = detail.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
rowno++;
|
|
row++;
|
|
}
|
|
//rowno++;
|
|
}
|
|
if (header.filter == (decimal?) 4.2)
|
|
{
|
|
foreach (var detail in header.data)
|
|
{
|
|
decimal? sums1 = detail.male1 + detail.female1;
|
|
decimal? sums2 = detail.male2 + detail.female2;
|
|
decimal? sums3 = detail.male3 + detail.female3;
|
|
decimal? sums4 = detail.male4 + detail.female4;
|
|
decimal? sums5 = detail.male5 + detail.female5;
|
|
decimal? sums6 = detail.male6 + detail.female6;
|
|
decimal? sumsroom = detail.room1 + detail.room2 +detail.room3 + detail.room4 +detail.room5 + detail.room6;
|
|
ws.Cell(row, 1).Value = detail.name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = detail.male1;
|
|
ws.Cell(row, 4).Value = detail.female1;
|
|
ws.Cell(row, 5).Value = sums1;
|
|
ws.Cell(row, 6).Value = detail.room1;
|
|
ws.Cell(row, 7).Value = detail.male2;
|
|
ws.Cell(row, 8).Value = detail.female2;
|
|
ws.Cell(row, 9).Value = sums2;
|
|
ws.Cell(row, 10).Value = detail.room2;
|
|
ws.Cell(row, 11).Value = detail.male3;
|
|
ws.Cell(row, 12).Value = detail.female3;
|
|
ws.Cell(row, 13).Value = sums5;
|
|
ws.Cell(row, 14).Value = detail.room3;
|
|
ws.Cell(row, 15).Value = detail.male4;
|
|
ws.Cell(row, 16).Value = detail.female4;
|
|
ws.Cell(row, 17).Value = sums4;
|
|
ws.Cell(row, 18).Value = detail.room4;
|
|
ws.Cell(row, 19).Value = detail.male5;
|
|
ws.Cell(row, 20).Value = detail.female5;
|
|
ws.Cell(row, 21).Value = sums5;
|
|
ws.Cell(row, 22).Value = detail.room5;
|
|
ws.Cell(row, 23).Value = detail.male6;
|
|
ws.Cell(row, 24).Value = detail.female6;
|
|
ws.Cell(row, 25).Value = sums6;
|
|
ws.Cell(row, 26).Value = detail.room6;
|
|
ws.Cell(row, 27).Value = detail.male7;
|
|
ws.Cell(row, 28).Value = detail.female7;
|
|
ws.Cell(row, 29).Value = sums1+sums2+sums3+sums4+sums5+sums6;
|
|
ws.Cell(row, 30).Value = sumsroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
// ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
// ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
}
|
|
|
|
if (header.filter == 5)
|
|
{
|
|
ws.Cell(row, 1).Value = header.header_name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = header.male1;
|
|
ws.Cell(row, 4).Value = header.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = header.room1;
|
|
ws.Cell(row, 7).Value = header.male2;
|
|
ws.Cell(row, 8).Value = header.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = header.room2;
|
|
ws.Cell(row, 11).Value = header.male3;
|
|
ws.Cell(row, 12).Value = header.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = header.room3;
|
|
ws.Cell(row, 15).Value = header.male4;
|
|
ws.Cell(row, 16).Value = header.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = header.room4;
|
|
ws.Cell(row, 19).Value = header.male5;
|
|
ws.Cell(row, 20).Value = header.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = header.room5;
|
|
ws.Cell(row, 23).Value = header.male6;
|
|
ws.Cell(row, 24).Value = header.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = header.room6;
|
|
ws.Cell(row, 27).Value = header.male7;
|
|
ws.Cell(row, 28).Value = header.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor =
|
|
XLColor.Gainsboro;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.Gainsboro;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
if (header.filter == (decimal?) 5.1)
|
|
{
|
|
foreach (var detail in header.data)
|
|
{
|
|
decimal? sums1 = detail.male1 + detail.female1;
|
|
decimal? sums2 = detail.male2 + detail.female2;
|
|
decimal? sums3 = detail.male3 + detail.female3;
|
|
decimal? sums4 = detail.male4 + detail.female4;
|
|
decimal? sums5 = detail.male5 + detail.female5;
|
|
decimal? sums6 = detail.male6 + detail.female6;
|
|
decimal? sumsroom = detail.room1 + detail.room2 + detail.room3 + detail.room4 +
|
|
detail.room5 + detail.room5 + detail.room6;
|
|
ws.Cell(row, 1).Value = detail.name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = detail.male1;
|
|
ws.Cell(row, 4).Value = detail.female1;
|
|
ws.Cell(row, 5).Value = sums1;
|
|
ws.Cell(row, 6).Value = detail.room1;
|
|
ws.Cell(row, 7).Value = detail.male2;
|
|
ws.Cell(row, 8).Value = detail.female2;
|
|
ws.Cell(row, 9).Value = sums2;
|
|
ws.Cell(row, 10).Value = detail.room2;
|
|
ws.Cell(row, 11).Value = detail.male3;
|
|
ws.Cell(row, 12).Value = detail.female3;
|
|
ws.Cell(row, 13).Value = sums3;
|
|
ws.Cell(row, 14).Value = detail.room3;
|
|
ws.Cell(row, 15).Value = detail.male4;
|
|
ws.Cell(row, 16).Value = detail.female4;
|
|
ws.Cell(row, 17).Value = sums4;
|
|
ws.Cell(row, 18).Value = detail.room4;
|
|
ws.Cell(row, 19).Value = detail.male5;
|
|
ws.Cell(row, 20).Value = detail.female5;
|
|
ws.Cell(row, 21).Value = sums5;
|
|
ws.Cell(row, 22).Value = detail.room5;
|
|
ws.Cell(row, 23).Value = detail.male6;
|
|
ws.Cell(row, 24).Value = detail.female6;
|
|
ws.Cell(row, 25).Value = sums6;
|
|
ws.Cell(row, 26).Value = detail.room6;
|
|
ws.Cell(row, 27).Value = detail.male7;
|
|
ws.Cell(row, 28).Value = detail.female7;
|
|
ws.Cell(row, 29).Value = sums1+sums2+sums3+sums4+sums5+sums6;
|
|
ws.Cell(row, 30).Value = sumsroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
// ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
// ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
// ws.Cell(row, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
}
|
|
|
|
if (header.filter == 6)
|
|
{
|
|
ws.Cell(row, 1).Value = header.header_name;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = header.male1;
|
|
ws.Cell(row, 4).Value = header.female1;
|
|
ws.Cell(row, 5).Value = sum1;
|
|
ws.Cell(row, 6).Value = header.room1;
|
|
ws.Cell(row, 7).Value = header.male2;
|
|
ws.Cell(row, 8).Value = header.female2;
|
|
ws.Cell(row, 9).Value = sum2;
|
|
ws.Cell(row, 10).Value = header.room2;
|
|
ws.Cell(row, 11).Value = header.male3;
|
|
ws.Cell(row, 12).Value = header.female3;
|
|
ws.Cell(row, 13).Value = sum3;
|
|
ws.Cell(row, 14).Value = header.room3;
|
|
ws.Cell(row, 15).Value = header.male4;
|
|
ws.Cell(row, 16).Value = header.female4;
|
|
ws.Cell(row, 17).Value = sum4;
|
|
ws.Cell(row, 18).Value = header.room4;
|
|
ws.Cell(row, 19).Value = header.male5;
|
|
ws.Cell(row, 20).Value = header.female5;
|
|
ws.Cell(row, 21).Value = sum5;
|
|
ws.Cell(row, 22).Value = header.room5;
|
|
ws.Cell(row, 23).Value = header.male6;
|
|
ws.Cell(row, 24).Value = header.female6;
|
|
ws.Cell(row, 25).Value = sum6;
|
|
ws.Cell(row, 26).Value = header.room6;
|
|
ws.Cell(row, 27).Value = header.male7;
|
|
ws.Cell(row, 28).Value = header.female7;
|
|
ws.Cell(row, 29).Value = sum1+sum2+sum3+sum4+sum5+sum6;
|
|
ws.Cell(row, 30).Value = sumroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor = XLColor.White;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.White;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Style.Font.Bold = true;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
|
|
if (header.filter == (decimal?) 3.1)
|
|
{
|
|
foreach (var detail in header.data)
|
|
{
|
|
decimal? sums1 = detail.male1 + detail.female1;
|
|
decimal? sums2 = detail.male2 + detail.female2;
|
|
decimal? sums3 = detail.male3 + detail.female3;
|
|
decimal? sums4 = detail.male4 + detail.female4;
|
|
decimal? sums5 = detail.male5 + detail.female5;
|
|
decimal? sums6 = detail.male6 + detail.female6;
|
|
decimal? sumsroom = detail.room1 + detail.room2 + detail.room3 + detail.room4 +
|
|
detail.room5 + detail.room5 + detail.room6;
|
|
ws.Cell(row, 1).Value = rowno;
|
|
ws.Cell(row, 2).Value = detail.name;
|
|
ws.Cell(row, 3).Value = detail.male1;
|
|
ws.Cell(row, 4).Value = detail.female1;
|
|
ws.Cell(row, 5).Value = sums1;
|
|
ws.Cell(row, 6).Value = detail.room1;
|
|
ws.Cell(row, 7).Value = detail.male2;
|
|
ws.Cell(row, 8).Value = detail.female2;
|
|
ws.Cell(row, 9).Value = sums2;
|
|
ws.Cell(row, 10).Value = detail.room2;
|
|
ws.Cell(row, 11).Value = detail.male3;
|
|
ws.Cell(row, 12).Value = detail.female3;
|
|
ws.Cell(row, 13).Value = sums3;
|
|
ws.Cell(row, 14).Value = detail.room3;
|
|
ws.Cell(row, 15).Value = detail.male4;
|
|
ws.Cell(row, 16).Value = detail.female4;
|
|
ws.Cell(row, 17).Value = sums4;
|
|
ws.Cell(row, 18).Value = detail.room4;
|
|
ws.Cell(row, 19).Value = detail.male5;
|
|
ws.Cell(row, 20).Value = detail.female5;
|
|
ws.Cell(row, 21).Value = sums5;
|
|
ws.Cell(row, 22).Value = detail.room5;
|
|
ws.Cell(row, 23).Value = detail.male6;
|
|
ws.Cell(row, 24).Value = detail.female6;
|
|
ws.Cell(row, 25).Value = sums6;
|
|
ws.Cell(row, 26).Value = detail.room6;
|
|
ws.Cell(row, 27).Value = detail.male7;
|
|
ws.Cell(row, 28).Value = detail.female7;
|
|
ws.Cell(row, 29).Value = sums1+sums2+sums3+sums4+sums5+sums6;
|
|
ws.Cell(row, 30).Value = sumsroom;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
rowno++;
|
|
row++;
|
|
}
|
|
}
|
|
if (header.filter == 0)
|
|
{
|
|
ws.Cell(row, 1).Value = null;
|
|
ws.Cell(row, 2).Value = null;
|
|
ws.Cell(row, 3).Value = null;
|
|
ws.Cell(row, 4).Value = null;
|
|
ws.Cell(row, 5).Value = null;
|
|
ws.Cell(row, 6).Value = null;
|
|
ws.Cell(row, 7).Value = null;
|
|
ws.Cell(row, 8).Value = null;
|
|
ws.Cell(row, 9).Value = null;
|
|
ws.Cell(row, 10).Value = null;
|
|
ws.Cell(row, 11).Value = null;
|
|
ws.Cell(row, 12).Value = null;
|
|
ws.Cell(row, 13).Value = null;
|
|
ws.Cell(row, 14).Value = null;
|
|
ws.Cell(row, 15).Value = null;
|
|
ws.Cell(row, 16).Value = null;
|
|
ws.Cell(row, 17).Value = null;
|
|
ws.Cell(row, 18).Value = null;
|
|
ws.Cell(row, 19).Value = null;
|
|
ws.Cell(row, 20).Value = null;
|
|
ws.Cell(row, 21).Value = null;
|
|
ws.Cell(row, 22).Value = null;
|
|
ws.Cell(row, 23).Value = null;
|
|
ws.Cell(row, 24).Value = null;
|
|
ws.Cell(row, 25).Value = null;
|
|
ws.Cell(row, 26).Value = null;
|
|
ws.Cell(row, 27).Value = null;
|
|
ws.Cell(row, 28).Value = null;
|
|
ws.Cell(row, 29).Value = null;
|
|
ws.Cell(row, 30).Value = null;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontName = "TH Sarabun New";
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Font.FontSize = 14;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 2)).Merge().Style.Fill.BackgroundColor =
|
|
XLColor.White;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Fill.BackgroundColor = XLColor.White;
|
|
ws.Cell(row, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
|
ws.Cell(row, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Horizontal =
|
|
XLAlignmentHorizontalValues.Right;
|
|
ws.Range(ws.Cell(row, 3), ws.Cell(row, 30)).Style.Alignment.Vertical =
|
|
XLAlignmentVerticalValues.Center;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
|
|
ws.Range(ws.Cell(row, 1), ws.Cell(row, 30)).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
row++;
|
|
}
|
|
}
|
|
}
|
|
|
|
using (var stream = new MemoryStream())
|
|
{
|
|
workbook.SaveAs(stream);
|
|
var content = stream.ToArray();
|
|
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
return File(
|
|
content,
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"std" + date + ".xlsx");
|
|
}
|
|
}
|
|
}
|
|
} |