Handling truncated leading spaces in Reporting Services

  • Hi,

    I am supposed to display Hirerachical data in SSRS

    Example:

    Description

    Captain

    Lieutenant

    Sergeant

    Corporal

    Private

    And for that I did: = replace(First(Fields!Row_Description.Value), " ", " "). The Description columns shows hirerarchical data perfectly fine in PREVIEW in Microsoft Visual Studio 2005.

    HOWEVER

    When I deploy the same report on actual site, description column looks like:

    Description

    Captain

    Lieutenant

    Sergeant

    Corporal

    Private

    Any Idea why would that happen??

    Thanks

  • an HTML report ignores whitespace...so to handle that, you'd probably want to .Replace " ", "& n b s p ; " or with CHAR(160) which is a space in most fonts, but not ignored by HTML.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Ok! this is what i did

    Step 1: I cast Row_Description column as char(160)

    step2: I add this expressions: = replace(First(Fields!Row_Description.Value), " ", "& n b s p ; ")

    Now I am getting following result:

    & n b s p ; "& n b s p ; "Operating"& n b s p ; ""& n b s p ; "Maintenance"& n b s p ; ""& n b s p ; "

    Thank you

  •   is the html symbol for non breaking space.

    the forum here will convert   into the html space...so you wouldn't see what i was talking about. i had to add extra spaces to it or fully html-escape it so it would not get converted to html by the forum . sorry i thought it was obvious.

    try either of these two and let me know if that works for you:

    --remove teh space after the ampersand

    = Replace(First(Fields!Row_Description.Value), " ","& nbsp;")

    = Replace(First(Fields!Row_Description.Value), " ", Chr(160))

    it took me EIGHT edits to get this to kinda display. using an html forum to describe html tags is hard.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thank you Lowell

    This works 🙂

    --------------------------------------------------------------------------------

  • HI,

    When I have a html string in my DB with "" to print leading where I expect the output to be like the one below:

    Description : Smear studied shows parabasal cells with few neutrophils in background.

    There is no evidence of specific infection, dysplasia and malignancy in smear

    studied.

    Insteads it renders like this:

    Description : Smear studied shows parabasal cells with few neutrophils in background.

    There is no evidence of specific infection, dysplasia and malignancy in smear studied.

    Can anyone help please...

  • you need to replace vbCrLf with the html break tag <br /> & vbCrLf, whether in the data source at SQL, or in the textbox/panel you are loading the data into on the report.

    HTML does not repsect whitespace...tabs, carriage returns, or more than one space in a row are all converted to a single space character.

    formatting is done with tags or special escape characters, as mentioned above.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply