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