注:以下示例可应用于K/3CloudV2.0 SP3+2013-10-21号补丁
简单的列表行背景se可以直接通过表单属性“列表格式化”设置,而对于按复杂的条件来格式化数据行颜se,则可以参考以下代码
1、python示例
import clr
clr.AddReference('System.Drawing')
from System.Drawing import *
from Kingdee.BOS.Core.Metadata import *
from Kingdee.BOS.Core.Report.PlugIn import *
def OnFormatRowConditions(args):
fc =FormatCondition()
fc.ApplayRow = True
##this.View.ShowMessage( args.DataRow["FUserName"].ToString())
if (args.DataRow.ColumnContains("FUserName")==True):
if(args.DataRow["FUserName"].ToString() == "Dev"):##用户等于Dev
fc.BackColor = ColorTranslator.ToHtml(Color.Blue);
args.FormatConditions.Add(fc)
复制代码
2、C#示例
public class XXXXRptPlugIn : AbstractSysReportPlugIn
{
public override void OnFormatRowConditions(Core.Report.PlugIn.Args.ReportFormatConditionArgs args)
{
FormatCondition fc = new FormatCondition();
fc.ApplayRow = true;
if (args.DataRow.ColumnContains("FUserName")&&args.DataRow["FUserName"].ToString() ==
"Dev")// 用户等于Dev
{
fc.BackColor = ColorTranslator.ToHtml(System.Drawing.Color.Blue);// 背景se蓝se;
}
args.FormatConditions.Add(fc);
}
}
复制代码
推荐阅读