[python学习笔记]设置单据体字段字体颜色(前景色)原创
金蝶云社区-筱泉
筱泉
11人赞赏了该文章 2,060次浏览 未经作者许可,禁止转载编辑于2022年01月18日 16:27:04
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.DataEntity')
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from Kingdee.BOS.Orm.DataEntity import *

def AfterBindData(e):
    entity = this.View.BillBusinessInfo.GetEntity('FEntity') # FEntity 为单据体标识
    objCollection =this.View.Model.GetEntityDataObject(entity)
    grid =this.View.GetControl('FEntity')
    for index in range(len(objCollection)):
        obj = objCollection[index]
        valDebit = obj["Score"]
        if valDebit is not None :
            grid.SetForecolor("FScore","#FF0000", index);#需要设置字段标识Key

   

效果如图:

图片.png





特别注意,python非常注意缩进,一定记得保持缩进!!!


赞 11