金蝶云 PYTHON
调整单据体行颜色。【注意】颜色仅对只读的单元格生效。
import clr
clr.AddReference('Kingdee.BOS.Core')
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
import sys
from System import *
from System.Collections.Generic import *
from System.Collections.Generic import List as syslist
def AfterEntryBarItemClick(e):
grid = this.View.GetControl[EntryGrid]("FEntity")#需要设置的单据体标识Key
rowcount = this.View.Model.GetEntryRowCount("FEntity");
colors=syslist[KeyValuePair[int,String]]()
colors2=syslist[KeyValuePair[int,String]]()
for i in range(rowcount):
if i==0:
_KeyValuePair=KeyValuePair[int,String](i,"#FFFF00")
colors.Add(_KeyValuePair)
grid.SetRowBackcolor(colors)#设置整行背景颜色
if i==1:
grid.SetBackcolor("FMaterialName", "#FFFF00",i)#设置单元格背景颜色
if i==2:
_KeyValuePair=KeyValuePair[int,String](i,"#FFFF00")
colors2.Add(_KeyValuePair)
grid.SetCellsBackcolor("FMaterialName",colors2)#设置单元格颜色
if i==3:
grid.SetForecolor("FMaterialName","#FFFF00",i)#设置单元格字体颜色