bug fixed

This commit is contained in:
kamonwan taengsuk
2023-03-15 20:21:28 +07:00
parent 8a96a4ded0
commit fd4e1bd21e

View File

@@ -4,6 +4,7 @@ using System.IO;
using ClosedXML.Excel; using ClosedXML.Excel;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using rmutr_report.Models; using rmutr_report.Models;
using SeventyOneDev.Utilities;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
namespace rmutr_report.Controllers namespace rmutr_report.Controllers
@@ -45,7 +46,8 @@ namespace rmutr_report.Controllers
ws.Column(10).Width = 25; ws.Column(10).Width = 25;
ws.Column(11).Width = 30; ws.Column(11).Width = 30;
int row = 8; int row = 8;
int row2 = 9; int col = 11;
int x = 2;
//ws.Cell(row, 3).SetDataType(XLDataType.Number); //ws.Cell(row, 3).SetDataType(XLDataType.Number);
if (_teaching_fee_extra != null) if (_teaching_fee_extra != null)
{ {
@@ -199,8 +201,9 @@ namespace rmutr_report.Controllers
ws.Cell(row, 8).Value = teaching.number_of_weeks2; ws.Cell(row, 8).Value = teaching.number_of_weeks2;
ws.Cell(row, 9).Value = teaching.amount2; ws.Cell(row, 9).Value = teaching.amount2;
ws.Cell(row, 10).Value = teaching.total_amount; ws.Cell(row, 10).Value = teaching.total_amount;
//ws.Cell(row, 11).Value = teaching.major; //ws.Range(ws.Cell(row, 11), ws.Cell(row, 11)).Merge();
ws.Range(ws.Cell(row, 11), ws.Cell(row2, 11)).Merge().Value = teaching.major; ws.Range(ws.Cell(row, col), ws.Cell(row+x, col)).Merge().Value = teaching.major;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
"TH SarabunPSK"; "TH SarabunPSK";
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
@@ -220,7 +223,7 @@ namespace rmutr_report.Controllers
ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White; ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin; XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.RightBorder = ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
XLBorderStyleValues.Thin; XLBorderStyleValues.Thin;
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
@@ -232,93 +235,226 @@ namespace rmutr_report.Controllers
ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).SetDataType(XLDataType.Number); ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
row++; row++;
foreach (var datadetail in teaching.datadetail) foreach (var datadetail in teaching.datadetail)
{ {
if (datadetail.teacher != "รวมทั้งสิ้น") if (datadetail.teacher != "รวมทั้งสิ้น")
{ {
ws.Cell(row2, 2).Value = datadetail.teacher; ws.Cell(row, 2).Value = datadetail.teacher;
ws.Cell(row2, 3).Value = datadetail.teaching_rate; ws.Cell(row, 3).Value = datadetail.teaching_rate;
ws.Cell(row2, 4).Value = datadetail.number_of_hours1; ws.Cell(row, 4).Value = datadetail.number_of_hours1;
ws.Cell(row2, 5).Value = datadetail.number_of_weeks1; ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
ws.Cell(row2, 6).Value = datadetail.amount1; ws.Cell(row, 6).Value = datadetail.amount1;
ws.Cell(row2, 7).Value = datadetail.number_of_hours2; ws.Cell(row, 7).Value = datadetail.number_of_hours2;
ws.Cell(row2, 8).Value = datadetail.number_of_weeks2; ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
ws.Cell(row2, 9).Value = datadetail.amount2; ws.Cell(row, 9).Value = datadetail.amount2;
ws.Cell(row2, 10).Value = datadetail.total_amount; ws.Cell(row, 10).Value = datadetail.total_amount;
ws.Cell(row2, 11).Value = null; ws.Cell(row, 11).Value = null;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontName = //ws.Range(ws.Cell(row, col), ws.Cell(row, col)).Merge();
ws.Range(ws.Cell(row, col), ws.Cell(row, col )).Merge();
ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
"TH SarabunPSK"; "TH SarabunPSK";
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontSize = 16; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.Vertical = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center; XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.OutsideBorder = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin; XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.RightBorder = ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
XLBorderStyleValues.Thin; XLBorderStyleValues.Thin;
ws.Cell(row2, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row2, 4), ws.Cell(row2, 10)).SetDataType(XLDataType.Number); ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
row++;
} }
//row++; //row++;
if (datadetail.teacher == "รวมทั้งสิ้น") if (datadetail.teacher == "รวมทั้งสิ้น")
{ {
//ws.Cell(row2, 2).Value = datadetail.teacher; //ws.Cell(row2, 2).Value = datadetail.teacher;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 3)).Merge().Value = datadetail.teacher; ws.Range(ws.Cell(row, 2), ws.Cell(row, 3)).Merge().Value = datadetail.teacher;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 3)).Merge(); ws.Range(ws.Cell(row, 2), ws.Cell(row, 3)).Merge();
//ws.Cell(row2, 3).Value = datadetail.teaching_rate; //ws.Cell(row2, 3).Value = datadetail.teaching_rate;
ws.Cell(row2, 4).Value = datadetail.number_of_hours1; ws.Cell(row, 4).Value = datadetail.number_of_hours1;
ws.Cell(row2, 5).Value = datadetail.number_of_weeks1; ws.Cell(row, 5).Value = datadetail.number_of_weeks1;
ws.Cell(row2, 6).Value = datadetail.amount1; ws.Cell(row, 6).Value = datadetail.amount1;
ws.Cell(row2, 7).Value = datadetail.number_of_hours2; ws.Cell(row, 7).Value = datadetail.number_of_hours2;
ws.Cell(row2, 8).Value = datadetail.number_of_weeks2; ws.Cell(row, 8).Value = datadetail.number_of_weeks2;
ws.Cell(row2, 9).Value = datadetail.amount2; ws.Cell(row, 9).Value = datadetail.amount2;
ws.Cell(row2, 10).Value = datadetail.total_amount; ws.Cell(row, 10).Value = datadetail.total_amount;
ws.Cell(row2, 11).Value = null; ws.Cell(row, 11).Value = null;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontName = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
"TH SarabunPSK"; "TH SarabunPSK";
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontSize = 16; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.WrapText = true; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.Vertical = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
XLAlignmentVerticalValues.Center; XLAlignmentVerticalValues.Center;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.OutsideBorder = ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
XLBorderStyleValues.Thin; XLBorderStyleValues.Thin;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.RightBorder = ws.Range(ws.Cell(row, 2), ws.Cell(row, 10)).Style.Border.RightBorder =
XLBorderStyleValues.Thin; XLBorderStyleValues.Thin;
ws.Cell(row2, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
//ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; //ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Cell(row2, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Fill.BackgroundColor = XLColor.Bisque; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Fill.BackgroundColor = XLColor.Bisque;
ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.Bold = true; ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
ws.Range(ws.Cell(row2, 4), ws.Cell(row2, 10)).SetDataType(XLDataType.Number); ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
}
row2++;
}
row++; row++;
row2++;
} }
//row++;
//row2++;
}
//row++;
//row2++;
}
// foreach (var teaching in _teaching_fee_extra.data)
// {
// ws.Cell(row, 2).Value = teaching.course;
// ws.Cell(row, 3).Value = null;
// ws.Cell(row, 4).Value = teaching.number_of_hours1;
// ws.Cell(row, 5).Value = teaching.number_of_weeks1;
// ws.Cell(row, 6).Value = teaching.amount1;
// ws.Cell(row, 7).Value = teaching.number_of_hours2;
// ws.Cell(row, 8).Value = teaching.number_of_weeks2;
// ws.Cell(row, 9).Value = teaching.amount2;
// ws.Cell(row, 10).Value = teaching.total_amount;
// //ws.Cell(row, 11).Value = teaching.major;
// ws.Range(ws.Cell(row, 11), ws.Cell(row2, 11)).Merge().Value = teaching.major;
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontName =
// "TH SarabunPSK";
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.FontSize = 16;
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.WrapText = true;
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Alignment.Vertical =
// XLAlignmentVerticalValues.Center;
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Font.Bold = true;
// ws.Cell(row, 2).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 3).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 4).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 5).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 6).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 7).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 8).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 9).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 10).Style.Fill.BackgroundColor = XLColor.Gainsboro;
// ws.Cell(row, 11).Style.Fill.BackgroundColor = XLColor.White;
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.OutsideBorder =
// XLBorderStyleValues.Thin;
// ws.Range(ws.Cell(row, 2), ws.Cell(row, 11)).Style.Border.RightBorder =
// XLBorderStyleValues.Thin;
// ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
// ws.Cell(row, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
// ws.Cell(row, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Range(ws.Cell(row, 4), ws.Cell(row, 10)).Style.NumberFormat.SetFormat("#,#");
// //row++;
// foreach (var datadetail in teaching.datadetail)
// {
// if (datadetail.teacher != "รวมทั้งสิ้น")
// {
// ws.Cell(row2, 2).Value = datadetail.teacher;
// ws.Cell(row2, 3).Value = datadetail.teaching_rate;
// ws.Cell(row2, 4).Value = datadetail.number_of_hours1;
// ws.Cell(row2, 5).Value = datadetail.number_of_weeks1;
// ws.Cell(row2, 6).Value = datadetail.amount1;
// ws.Cell(row2, 7).Value = datadetail.number_of_hours2;
// ws.Cell(row2, 8).Value = datadetail.number_of_weeks2;
// ws.Cell(row2, 9).Value = datadetail.amount2;
// ws.Cell(row2, 10).Value = datadetail.total_amount;
// ws.Cell(row2, 11).Value = null;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontName =
// "TH SarabunPSK";
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontSize = 16;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.WrapText = true;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.Vertical =
// XLAlignmentVerticalValues.Center;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.OutsideBorder =
// XLBorderStyleValues.Thin;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.RightBorder =
// XLBorderStyleValues.Thin;
// ws.Cell(row2, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
// ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Range(ws.Cell(row2, 4), ws.Cell(row2, 10)).Style.NumberFormat.SetFormat("#,#");
// //row2++;
// }
// //row++;
// if (datadetail.teacher == "รวมทั้งสิ้น")
// {
// //ws.Cell(row2, 2).Value = datadetail.teacher;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 3)).Merge().Value = datadetail.teacher;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 3)).Merge();
// //ws.Cell(row2, 3).Value = datadetail.teaching_rate;
// ws.Cell(row2, 4).Value = datadetail.number_of_hours1;
// ws.Cell(row2, 5).Value = datadetail.number_of_weeks1;
// ws.Cell(row2, 6).Value = datadetail.amount1;
// ws.Cell(row2, 7).Value = datadetail.number_of_hours2;
// ws.Cell(row2, 8).Value = datadetail.number_of_weeks2;
// ws.Cell(row2, 9).Value = datadetail.amount2;
// ws.Cell(row2, 10).Value = datadetail.total_amount;
// ws.Cell(row2, 11).Value = null;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontName =
// "TH SarabunPSK";
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.FontSize = 16;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.WrapText = true;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Alignment.Vertical =
// XLAlignmentVerticalValues.Center;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.OutsideBorder =
// XLBorderStyleValues.Thin;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Border.RightBorder =
// XLBorderStyleValues.Thin;
// ws.Cell(row2, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// //ws.Cell(row2, 3).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 4).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 7).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 8).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 10).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Cell(row2, 11).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Fill.BackgroundColor = XLColor.Bisque;
// ws.Range(ws.Cell(row2, 2), ws.Cell(row2, 11)).Style.Font.Bold = true;
// ws.Range(ws.Cell(row2, 4), ws.Cell(row2, 10)).Style.NumberFormat.SetFormat("#,#");
// //row2++;
// }
// //row++;
// row2++;
// }
// row++;
// //row2++;
// }
} }
//}
using (var stream = new MemoryStream()) using (var stream = new MemoryStream())
{ {
workbook.SaveAs(stream); workbook.SaveAs(stream);