reporting-servicesrdl

Stripes in background in RDL


Is it possible to add stripes in the textbox in report?

So the result looks like in the picture? stripes in background

User chooses color for the column in the application color


Solution

  • This is no built in way of doing this (no fill style) but you could use an image of the stripes as a background image. You would need to create and save images for each colour and style and add them as embedded images in the report.

    You can then set the background image of a textbox to the required image.

    enter image description here

    ... or better still use an expression to select the image based on conditions.

    =SWITCH(
    Fields!ItemCode.Value >10 , "RedStripe",
    Fields!ItemCode.Value >50 , "GreenStripe",
    True, Nothing
    )
    

    Where Redstripe and GreenStripe are the image names you embedded.

    You can set the image to repeat etc from the properties panel

    enter image description here


    Update after OP stated that colour is parameterised.


    If the colour is a parameter then we need a slightly different approach.

    First you need to create an image with stripes (any colour will do ), and then remove the stripe pixels so that the stipes are now transparent. Save this as a PNG.

    I created one quickly whist testing which you can save from here hopefully. You'll just have to move the mouse around in the area below as it's a white on white image! Or switch StackOverflow to the dark theme, then you can right-click and save the image. If not you'll just have to create one yourself.

    Image below here.. switch StackOverflow to Dark theme to see it

    enter image description here

    Image above here..

    Now you will need to set the background image to this image but also set the backgroundcolor property to an expression. In this exmaple, I set the background to the value of my parameter.

    My parameter is just text and I typed in some hex values in the form #FFFFFF. You will have to work out how to get the value from your color pickers to the report yourself, ask a new question if required.

    Here's the report design

    enter image description here

    and here is the report running using a few sample hex values.

    enter image description here

    enter image description here

    enter image description here