SSRS: Get backgroundcolor from Cell

前端 未结 3 1163
孤独总比滥情好
孤独总比滥情好 2021-01-23 09:51

I\'ve got a report as a table. I would like to set for each column a random backgroundcolor.

For this i created a Custom Script:

Public Function GetColor         


        
3条回答
  •  抹茶落季
    2021-01-23 10:21

    Private string _LastColorUser="" 
    
    Public Function LastColorUsed()
      Return _LastColorUsed
    End Function
    
    Public Function GetColor()
    
        Dim intHighNumber AS Decimal = 255
        Dim intLowNumber AS Decimal = 100
    
        Dim NewColor AS String
        Dim Red AS Decimal = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
        Dim Green AS Decimal = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
        Dim Blue AS Decimal = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
    
    
        NewColor = "#" & Hex(Red) & Hex(Green) & Hex(Blue)
    
        _LastColorUser=NewColor;  
    
        Return NewColor
    End Function
    

提交回复
热议问题