, , , ,


In my SSRS report I wanted to display my text starting with some spaces indented from Left. So, in the text box I used the following expression:

="   " & Fields!customeridname.Value

While previewing my designed report everything looked perfect. But when I run that report in CRM using IE then the spaces were missing !!!
However, when I exported that same report to Word then the Spaces were back again and report Output came perfect.

Looking deep into the matter I came to know that IE automatically strips out spaces in HTML and also collapse multiple consecutive whitespace into single space.

So after some more reading I finally found a workaround; chr(160).

chr(160) also known as Hard space / Fixed space / Non-Breaking space etc. It is a variant of the space character that prevents automatic line break and space wrap at its position.

Ex 1: 100 km sometimes breaks into 2 different lines to fit at the end of line. So this guarantees that the text “100 km” will not be broken, even if it doesn’t fit the end of line then the entire text will move to next line.

Ex 2: Even sequence of whitespace characters are treated as single whitespace char.                     

                                         Rank 1

                Rank 2                                     Rank 3

The Output will be something like this:

Rank 1
Rank 2 Rank 3

So this chr(160) will preserve the spaces to be displayed in HTML.

Coming back to the solution of my issue, I finally used the following Expression:

=chr(160) & chr(160) & chr(160) & Fields!customeridname.Value

Hope this will be Helpful to those struggling with Spaces in SSRS reports in IE.

Thanks !!!