在水晶报表的报表头中提供动态名称

时间:2014-03-27 08:31:45

标签: c# asp.net wpf mvvm crystal-reports-2008

我在下拉列表的选择更改中生成一个Crystal报表... 一切都很完美但我要实现的另一件事是动态报表头(即下拉文本应该显示在页眉中)。任何建议......?

       public void FillMonthlySalesData()
    {
        _totalAmount = 0;
        foreach (SalesReportInfo SalesRecord in _salesReportViewModel.SalesmonthlyreportInfo)
        {
            DataRow objRowSales = _salesReturnreportDS.Tables["MonthlySalesTable"].NewRow();
            objRowSales["SINo"] = _mno++;
            objRowSales["Date"] = SalesRecord.SalesDate;
            objRowSales["Total"] = SalesRecord.Nettotal;
            _totalMonthlyAmount = _totalMonthlyAmount + SalesRecord.Nettotal;
             _month =  SalesRecord.SalesDate.Month;
             _year = SalesRecord.SalesDate.Year;
            _salesReturnreportDS.Tables["MonthlySalesTable"].Rows.Add(objRowSales);

        }
        DataRow objRow1 = _salesReturnreportDS.Tables["MonthlySalesTable"].NewRow();
        objRow1["NetTotal"] = _totalMonthlyAmount;
        objRow1["Month"] = _month;
        objRow1["Year"] = _year; ;



        _salesReturnreportDS.Tables["MonthlySalesTable"].Rows.Add(objRow1);
    }

1 个答案:

答案 0 :(得分:3)

dt.columns.Add("ReportHeader");
for(int i=0;i<dt.rows.count;i++)
{
dt.rows[i]["ReportHeader"]=comboReportHeader.Text;
}

试试这个