update
This commit is contained in:
@@ -141,54 +141,85 @@ namespace rmutr_report.Controllers
|
||||
ws.Range("D2:E2").Style.Font.Bold = true;
|
||||
foreach (var header in _kpi.header_data)
|
||||
{
|
||||
string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " :";
|
||||
no++;
|
||||
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
|
||||
ws.Cell(row, 2).Value = header.header_1;
|
||||
ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.None;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 8)).Merge().Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||
ws.Range(ws.Cell(row, 3), ws.Cell(row, 8)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
row++;
|
||||
string target = "เป้าหมายหลัก :";
|
||||
ws.Cell(row, 1).SetValue(target).Style.Font.Bold = true;
|
||||
int g = target.Length;
|
||||
g++;
|
||||
ws.Cell(row, 2).Value = header.header_2;
|
||||
ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.LavenderBlush;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.None;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 8)).Merge().Style.Fill.BackgroundColor =
|
||||
XLColor.LavenderBlush;
|
||||
ws.Range(ws.Cell(row, 3), ws.Cell(row, 8)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.TopBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 1).Style.Border.TopBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
row++;
|
||||
ws.Cell(row, 1).Value = "ตัวชี้วัดกลยุทธ์ : " + header.indicator_type_name_th;
|
||||
ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.Beige;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 8)).Merge().Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 1).Style.Font.Bold = true;
|
||||
row++;
|
||||
if (header.header_1 != null || header.header_1 != "")
|
||||
{
|
||||
string kpiname = "ประเด็นยุทธ์ศาสตร์ที่ " + no + " :";
|
||||
no++;
|
||||
ws.Cell(row, 1).SetValue(kpiname).Style.Font.Bold = true;
|
||||
ws.Cell(row, 2).Value = header.header_1;
|
||||
ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.None;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 8)).Merge().Style.Fill.BackgroundColor = XLColor.Bisque;
|
||||
ws.Range(ws.Cell(row, 3), ws.Cell(row, 8)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
row++;
|
||||
}
|
||||
if (header.header_1 == null)
|
||||
{
|
||||
header.header_1 = null;
|
||||
}
|
||||
|
||||
if (header.header_2!=null||header.header_2!="")
|
||||
{
|
||||
string target = "เป้าหมายหลัก :";
|
||||
ws.Cell(row, 1).SetValue(target).Style.Font.Bold = true;
|
||||
int g = target.Length;
|
||||
g++;
|
||||
ws.Cell(row, 2).Value = header.header_2;
|
||||
ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.LavenderBlush;
|
||||
ws.Cell(row, 1).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.None;
|
||||
ws.Range(ws.Cell(row, 2), ws.Cell(row, 8)).Merge().Style.Fill.BackgroundColor =
|
||||
XLColor.LavenderBlush;
|
||||
ws.Range(ws.Cell(row, 3), ws.Cell(row, 8)).Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Border.TopBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 1).Style.Border.TopBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left;
|
||||
row++;
|
||||
}
|
||||
if (header.header_2 == null)
|
||||
{
|
||||
header.header_2 = null;
|
||||
}
|
||||
|
||||
// if (header.indicator_type_name_th!=null||header.indicator_type_name_th!="")
|
||||
// {
|
||||
// ws.Cell(row, 1).Value = "ตัวชี้วัดกลยุทธ์ : " + header.indicator_type_name_th;
|
||||
// ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.Beige;
|
||||
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 8)).Merge().Style.Border.OutsideBorder =
|
||||
// XLBorderStyleValues.Thin;
|
||||
// ws.Cell(row, 1).Style.Font.Bold = true;
|
||||
// row++;
|
||||
// }
|
||||
// if (header.indicator_type_name_th == null)
|
||||
// {
|
||||
// header.indicator_type_name_th = null;
|
||||
// }
|
||||
//var data = _kpi.header_data.Select(d => d.data).ToList();
|
||||
// foreach (var detail in header)
|
||||
// {
|
||||
|
||||
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;
|
||||
foreach (var data in header.data)
|
||||
{
|
||||
|
||||
if (data.indicator_type_name_th != null || data.indicator_type_name_th != "")
|
||||
{
|
||||
ws.Cell(row, 1).Value = "ตัวชี้วัดกลยุทธ์ : " + data.indicator_type_name_th;
|
||||
ws.Cell(row, 1).Style.Fill.BackgroundColor = XLColor.Beige;
|
||||
ws.Range(ws.Cell(row, 1), ws.Cell(row, 8)).Merge().Style.Border.OutsideBorder =
|
||||
XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 1).Style.Font.Bold = true;
|
||||
row++;
|
||||
}
|
||||
|
||||
foreach (var data1 in data.data_detail)
|
||||
{
|
||||
ws.Cell(row, 2).Value = data1.row;
|
||||
ws.Cell(row, 3).Value = data1.name;
|
||||
ws.Cell(row, 4).Value = data1.unit;
|
||||
ws.Cell(row, 5).Value = data1.value;
|
||||
@@ -228,9 +259,16 @@ namespace rmutr_report.Controllers
|
||||
ws.Cell(row, 8).Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
||||
ws.Cell(row, 8).Style.Alignment.WrapText = true;
|
||||
row++;
|
||||
rowno++;
|
||||
//rowno++;
|
||||
|
||||
// if (rowno > 1)
|
||||
// {
|
||||
// ws.Range(ws.Cell(row, 1), ws.Cell(row, 1)).Merge();
|
||||
//
|
||||
// }
|
||||
}
|
||||
//row++;
|
||||
}
|
||||
//row++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,21 +14,28 @@ namespace rmutr_report.Models
|
||||
{
|
||||
public string header_1 { get; set; }
|
||||
public string header_2 { get; set; }
|
||||
public string indicator_type_name_th { get; set; }
|
||||
//public string indicator_type_name_th { get; set; }
|
||||
public List<kpi_data_details> data { get; set; }
|
||||
}
|
||||
|
||||
public class kpi_data_details
|
||||
{
|
||||
|
||||
//public int? row { get; set; }
|
||||
public string indicator_type_name_th { get; set; }
|
||||
|
||||
public List<kpi_data_details2> data_detail { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class kpi_data_details2
|
||||
{
|
||||
public int? row { get; set; }
|
||||
public string name { get; set; }
|
||||
public string unit { get; set; }
|
||||
public decimal? value { get; set; }
|
||||
public string responsible_person { get; set; }
|
||||
public string responsible_work { get; set; }
|
||||
public string collector { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user