Unable to Add New Line Character in SQLServer 2005 Reporting Services

  • Hi

    Unable to Add New Line Character in SQLServer 2005 Reporting Services TextBox control.

    My Problem is:

    In my report page i have to show the  Address of the  Customer. I have filed in the database Address1, Address2 , Address3 , Town , City fields...

    I tried to show all the 5 fields in one text box. 

    For me Data's are comint but the new line character not adding the database.. I written expression's as follows

    = Fields!Address1.Value & Chr(13) &  Fields!Address2.Value & Chr(13) &  Fields!Address3.Value & Chr(13) &  Fields!Town.Value  & Chr(13) &  Fields!City.Value

    ( And Triied with Text Height also Right click text box -> Format -> Textbox Height -> Can Increase to accommodate contents /  Can Decrease to accommodate contents -> Uncheck/Check  that also it is not working.)

    I tried with different textbox each field. But If Address3 is not having the data that time i have to move the Town field information to the address3 field place. If I used different textbox means it is giving empty text box for null value fields

    Please send your Suggestions to following mail id's sundaraguru_s@apollohealthstreet.com and sundharmail@yahoo.co.in.

    Advance Thanks

    Kind Regards

    Sundaraguru S


    Kind Regards,

    Sundaraguru S

  • Post this in RS section so that some one can answer from RS team..

     

    MohammedU
    Microsoft SQL Server MVP

  • Try something like this.

    =Fields!addresslineone.Value &

    IIF(

    NOT ISNOTHING(Fields!addresslinetwo.Value), chr(13) & CHR(10) & Fields!addresslinetwo.Value, "") &

    IIF(

    NOT ISNOTHING(Fields!addresslinethree.Value), chr(13) & CHR(10) & Fields!addresslinethree.Value, "") &

    CHR(13) & CHR(10) & Fields!city.Value &

    ", " & Fields!State.Value & " " & Fields!Zip.Value

  •   I've been trying to get a CR/LF in RS2005 text box for weeks - THANKS Grasshopper, chr(13) & CHR(10) does the job.

     

    Does anyone know how to change the format of a section of text within a text box? ie

    Does anyone know how to change the format of a section of text within a text box?

     

  • Hi David Sanders 

    You can use vbCrLf also..

    For adding new line character in the text box in RS.

     


    Kind Regards,

    Sundaraguru S

  • Use the vbCRLF rather than the char(10) + char(13) combination - the char(10) + char(13) works great in the designer but doesn't render correctly when published to reporting services...

    Joe

  • The replies above helped me finish something I've been looking all over the Internet for, which is a nice autoformatting address block for an SSRS report...here is code snippet that I hope others find userrful

    =Fields!FORMAL_NAME.Value & vbCRLF &

    Fields!ADDRESS1.Value & " " & Fields!ADDRESS3.Value & vbCRLF &

    Fields!ADDRESS2.Value & iif(Fields!ADDRESS2.Value="","",vbCrLf) &

    Fields!CITY.Value & ", " & Fields!STATE.Value & " " & Fields!POSTAL_CODE.Value &

    IIf(Fields!country.Value="UNITED STATES OF AMERICA","",vbCRLF & Fields!country.value)

  • You can also right click the text box and select "fx - Expression"

    On the new dialogue shown you can now enter CF/LF by pressing CTRL and RETURN together at the required locations.

  • the vbCRLF works in reportviewer (among others) but when I export to Excel, it ignores the line break even if I set the column to "Can Increase to accommodate contents"

    Anyone have an idea to make it work properly (i.e. cell should adjust height so the display would include the entries after the newlines)

  • I have used vbcrlf happily, and also vbtab works too. I've also used these in tooltips too.

  • Hi,

    Unfortunately, you cannot change the section of text in a textbox with RS 2005. This is a limitation of RS 2005. The RS 2008 (latest version) can do this rich text formatting for you.

    cheers,

    Neha

  • David Sanders-377900 (7/4/2007)


    <img src='images/emotions/biggrin.gif' height='20' width='20' border='0' title='Big Grin' align='absmiddle'> I've been trying to get a CR/LF in RS2005 text box for weeks - THANKS Grasshopper, chr(13) & CHR(10) does the job.

    Does anyone know how to change the format of a section of text within a text box? ie

    Does anyone know <STRONG>how to change the format of a section of text</STRONG> within a text box?

    Hi,

    Unfortunately, you cannot change the section of text in a textbox with RS 2005. This is a limitation of RS 2005. The RS 2008 (latest version) can do this rich text formatting for you.

    Regards,

    Neha

  • Environment.NewLine is the solution, It shows as unrecognized in the editor.. But works in the output, even in SSRS 2005.

    Good Luck!

    - Akula

  • Ryan Garaygay (8/9/2009)


    the vbCRLF works in reportviewer (among others) but when I export to Excel, it ignores the line break even if I set the column to "Can Increase to accommodate contents"

    Anyone have an idea to make it work properly (i.e. cell should adjust height so the display would include the entries after the newlines)

    I had this same problem when exporting to Excel. The problem only occurs when cells are merged. Make sure the cell with the line breaks isn't being broken up by some other element (in my case, the title text box) and it should resize as expected.

Viewing 14 posts - 1 through 13 (of 13 total)

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