Ejemplo n.º 1
0
    protected void btnExcel_Click(object sender, System.EventArgs e)
    {
        DataTable completedMonthlyReport = EReport.GetCompletedMonthlyReport(this.taskId, System.Convert.ToDateTime(this.date), this.hfldIsWBSRelevance.Value);
        DataTable dataTable = this.formatData(completedMonthlyReport, true);

        System.Collections.Generic.List <ExcelHeader> list = new System.Collections.Generic.List <ExcelHeader>();
        list.Add(ExcelHeader.Create("金额(元)", 1, 2, 5, 0));
        list.Add(ExcelHeader.Create("上期末完成", 1, 2, 7, 0));
        list.Add(ExcelHeader.Create("本期完成", 1, 2, 9, 0));
        list.Add(ExcelHeader.Create("本期末完成", 1, 2, 11, 0));
        System.Collections.Generic.List <int> list2 = new System.Collections.Generic.List <int>();
        foreach (DataColumn dataColumn in dataTable.Columns)
        {
            if (dataColumn.Ordinal >= 4)
            {
                list2.Add(dataColumn.Ordinal);
            }
            if (dataColumn.Ordinal < 4)
            {
                list.Add(ExcelHeader.Create(dataColumn.ColumnName, 2, 0, 0, 2));
            }
            else
            {
                list.Add(ExcelHeader.Create(dataColumn.ColumnName, 2, 0, 0, 0));
            }
        }
        ExcelHelper.ExportExcel(dataTable, this.title, this.title, this.title + ".xls", list, null, 0, base.Request.Browser.Browser);
    }
Ejemplo n.º 2
0
    protected void BindGv()
    {
        DataTable completedMonthlyReport = EReport.GetCompletedMonthlyReport(this.taskId, System.Convert.ToDateTime(this.date), this.hfldIsWBSRelevance.Value);

        this.gvConstruct.DataSource = this.formatData(completedMonthlyReport, false);
        this.gvConstruct.DataBind();
    }