–flexcpBackColor 背景色
cell(flexcpBackColor,row,col,row,col)=准则值
cell(准则,row,col,row,col)=准则值
eg:单元格1和2标记颜色
Cell(flexcpBackColor, 1, 1, 2, 2) = &HC0C0FF
当报表中第12列值为NO时,整行标红
If DataGrid.TextMatrix(DataGrid.Rows, 12) = "NO" Then
DataGrid.Cell(flexcpBackColor, DataGrid.Rows, 1, DataGrid.Rows, DataGrid.Cols) = &HC0C0FF
End If
当报表中第12列值为NO时,第2个单元格、第7个单元格标红
If DataGrid.TextMatrix(DataGrid.Rows, 12) = "NO" And
DataGrid.TextMatrix(DataGrid.Rows, 2) <> DataGrid.TextMatrix(DataGrid.Rows, 7) Then
DataGrid.Cell(flexcpBackColor, DataGrid.Rows, 2, DataGrid.Rows - 1, 2) = &HC0C0FF
DataGrid.Cell(flexcpBackColor, DataGrid.Rows, 7, DataGrid.Rows - 1, 7) = &HC0C0FF
End If
- 可以灵活使用一下cell(准则,row,col,row,col)=准则值中的 row,col,row,col;能做出多种效果。
- 可以搭配循环来使用
- 可以搭配某特定值时,加背景色,…
这篇博客介绍了如何利用编程技巧在报表中通过单元格的`flexcpBackColor`属性设置背景色,以及如何根据特定条件(如第12列值为'NO')动态改变行或单元格的背景色。示例代码展示了如何标记颜色,包括整行标红以及在特定条件下标红特定单元格,展示了一种灵活运用循环和条件语句的方法。
364

被折叠的 条评论
为什么被折叠?



