一、单据界面设置颜色(单据头、单据体),以下示例脚本为表单插件
#引入clr运行库
# -*- coding: utf-8 -*-
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *
def AfterBindData(e):
#设置单据头字段值前景色=====================================================
this.View.GetControl("F_ora_MulLangText").SetCustomPropertyValue("ForeColor", "#FF3300");
#设置单据头标题字段前景色=====================================================
this.View.GetControl("F_ora_MulLangText").SetCustomPropertyValue("TitleForceColor", "#FF3300");
#设置单据体============================================================
grid = this.View.GetControl[EntryGrid]("FEntity");#单据体标识
index=0;#单据体行号,从0开始,演示一行,如需设置多行,可用循环逻辑处理
#设置单据体---字段背景色,只对锁定单元格生效
grid.SetBackcolor("F_ora_Assistant","#00FF00",index);
#设置单据体----字段前景色,不支持非锁定状态下的数值字段
grid.SetForecolor("F_ora_EntryNote", "#FF0000",index);
#设置单据体----整行的颜色,只对锁定单元格生效
grid.SetRowBackcolor("#0000FF",index);
本文转载自:Python脚本各种应用场景设置颜色-整合介绍
作者:CQ周玉立
原文链接:https://vip.kingdee.com/article/298154365838782720?productLineId=1
推荐阅读