locked
Add carriage return into a multiline textbox in report (SQl Reporting Service 2000) RRS feed

  • Question

  • Hi,

    I need to add carriage returns into a text box of 3 lines.
    The data is pulled from the BD so the "cariage return" symbol need to be in the database field.

    I know that some reporting software give the option to add HTML code into textbox but I did'nt find out about ms reporting 2000.


    Thanks,

    Marco
    Saturday, October 6, 2007 12:59 AM

Answers

  • =First(Fields!string.Value).Replace("\r",VbCrLf) did not work for me.

    But this did:

    =First(Fields!string.Value).Replace(Chr(13),VbCrLf)
    Friday, April 3, 2009 12:39 AM

All replies

  • SRS uses a VB engine for evaluating expressions.  You can add a replacement command to the expression like this

     

    Code Block

    =First(Fields!string.Value).Replace("\r",VbCrLf)

     

     

    and you will get the cariage return you are wanting.  In the example above, I embedded '\r' in the sql string returned as follows

     

    Code Block
    select 'some\rtext\rfrom\rhere' as string

     

     

    and when the report rendered, the text box contained

     

    some

    text

    from

    here

     

    Good luck!

     

    Larry Smithmier

    Sunday, October 7, 2007 3:22 AM
  • Worked for me... thanks!
    Tuesday, March 25, 2008 7:26 PM
  • 18 Months latter and the advice is still good.

    Works a treat

    Thanks !

    Wednesday, February 11, 2009 5:49 PM
  • =First(Fields!string.Value).Replace("\r",VbCrLf) did not work for me.

    But this did:

    =First(Fields!string.Value).Replace(Chr(13),VbCrLf)
    Friday, April 3, 2009 12:39 AM
  • For me, my database data contained carriage returns which I wished to reflect in an SQLRS text field...... Mister Kens answer was the right one to replace these carriage return characters in the database field to vb carriage returns for my text box.

    Tuesday, September 8, 2009 9:33 AM