我已经创建了表格,我需要根据该列的第一行的值更改列的背景颜色。根据报告中的条件改变表格列中的背景颜色
如果特定列的第一行值为0或连字符( - ),则需要更改 1.)该列的背景色为灰色,否则为透明 2.)该特定列的行中的所有值应该填充连字符( - )。
下面是我试过的,但不能达到我的要求。
注意:我应该使用像XRTableCell这样的Reporting API控件。其他的想法也很受欢迎。
using System;
using System.Drawing;
using DevExpress.XtraReports.UI;
private void tableCell12_BeforePrint_1(object sender, System.Drawing.Printing.PrintEventArgs e)
{
XRTableCell tableCell = sender as XRTableCell;
double bancoAtivo = Convert.ToDouble(tableCell.Report.GetCurrentColumnValue("Campaign Count"));
if (bancoAtivo = 0)
{
tableCell.BackColor = Color.Grey;
}
else
{
tableCell.BackColor = Color.Transparent;
}
}
难道不是你的代码看起来像一个错字。您的代码应该做工精细根据你实现,但列名不能包含空格,如果路声明看起来不错。 –