我在下拉列表的选择更改中生成一个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);
}
答案 0 :(得分:3)
dt.columns.Add("ReportHeader");
for(int i=0;i<dt.rows.count;i++)
{
dt.rows[i]["ReportHeader"]=comboReportHeader.Text;
}
试试这个