WPF场景下查询数据并使用NPOI生成EXCEL表格

2021-01-04 07:28

阅读:430

标签:set   代码   span   repo   状态   fat   end   idc   string   

 WPF场景下后台生成DataGrid列的代码:

  1. /// 
            /// 通用的出勤表头设置
            /// 
            /// DataGrid实例
            /// 源数据表
            private void SetDataGridHearedOfAttendance(DataGrid dgView, DataTable dataTable)
                {
                dgView.ItemsSource = dataTable.DefaultView;
                dgView.Columns.Clear();
    
                TBCountMessage.Text = "" + SDate + "" + Edate + "   " +
                    "期间的出勤统计信息为: 正常出勤天数为:  "+rePortDp.NomalAttendancedays +"  天,半天数为:  "+rePortDp.HalfdayAttendancedays +"  个,加班时长为:  "+rePortDp.Workovertime+"  小时";
    
                DataGridTextColumn dategridcolumn = new DataGridTextColumn();
                dategridcolumn.Header = "出勤日期";
                dategridcolumn.Width = 180;
                dategridcolumn.Binding = new Binding("AttendanceDate");
                dategridcolumn.Binding.StringFormat = "yyyy年MM月dd日";
                dgView.Columns.Add(dategridcolumn);
    
                DataGridTextColumn DGTCattendancestatus = new DataGridTextColumn();
                DGTCattendancestatus.Header = "出勤状态";
                DGTCattendancestatus.Width = 120;
                DGTCattendancestatus.Binding = new Binding("AttendanceStatus");
                dgView.Columns.Add(DGTCattendancestatus);
    
    
                DataGridTextColumn DGTCattendanceHelper = new DataGridTextColumn();
                DGTCattendanceHelper.Header = "帮忙对象";
                DGTCattendanceHelper.Width = 120;
                DGTCattendanceHelper.Binding = new Binding("Helper");
                dgView.Columns.Add(DGTCattendanceHelper);
    
    
                DataGridTextColumn DGTCworkovertime = new DataGridTextColumn();
                DGTCworkovertime.Header = "加班时长";
                DGTCworkovertime.Width = 105;
                DGTCworkovertime.Binding = new Binding("WorkOfTime");
                DGTCworkovertime.Binding.StringFormat="0.0";
                dgView.Columns.Add(DGTCworkovertime);
    
                DataGridTextColumn DGTCattendanceremark = new DataGridTextColumn();
                DGTCattendanceremark.Header = "出勤备注";
                DGTCattendanceremark.Width = 300;
                DGTCattendanceremark.Binding = new Binding("AttendanceRemark");
                dgView.Columns.Add(DGTCattendanceremark);
                SetBtnSaveIsEnable(dgView);
    
    
               
    }

WPF场景下查询数据并使用NPOI生成EXCEL表格

标签:set   代码   span   repo   状态   fat   end   idc   string   

原文地址:https://www.cnblogs.com/Use-NPOI/p/12322071.html

上一篇:Windows 下配置Boost MPI

下一篇:C# 抽象类


评论


亲,登录后才可以留言!