How do I set a textbox to multi-line in SSRS?
-
09-06-2019 - |
Question
I have a report with many fields that I'm trying to get down to 1 page horizontally (I don't care whether it's 2 or 200 pages vertically... just don't want to have to deal with 2 pages wide by x pages long train-wreck). That said, it deals with contact information.
My idea was to do:
Name: Address: City: State: ...
Jon Doe Addr1 ThisTown XX ...
Addr2
Addr3
-----------------------------------------------
Jane Doe Addr1 ThisTown XX ...
Addr2
Addr3
-----------------------------------------------
Is there some way to set a textbox
to be multi-line (or the SQL result)? Have I missed something bloody obvious?
The CanGrow Property is on by default, and I've double checked that this is true. My problem is that I don't know how to force a line-break. I get the 3 address fields that just fills a line, then wraps to another. I've tried /n
, \n
(since I can never remember which is the correct slash to put), <br>
, <br />
(since the report will be viewed in a ReportViewer control in an ASP.NET website). I can't think of any other ways to wrap the text.
Is there some way to get the results from the database as 3 lines of text/characters?
Solution
Alter the report's text box to:
= Fields!Addr1.Value + VbCrLf +
Fields!Addr2.Value + VbCrLf +
Fields!Addr3.Value
OTHER TIPS
I had an additional problem after putting in the chr(10)
into the database.
In the field (within the report) add in:
=REPLACE(Fields!Addr1.Value, CHR(10), vbCrLf)
Hitting Shift+Enter while typing in the textbox creates a line break.
My data was captured in a SL application, needed this for the field expression
=REPLACE(Fields!Text.Value, CHR(13), vbCrLf)
I believe you need to set the CanGrow property to true on the Textbox. See http://msdn.microsoft.com/en-us/library/ms159116(SQL.90).aspx for some details.
link break do this
chr(10)
Try this one :
= Fields!Field1.Value + System.Environment.NewLine + Fields!Field2.Value
In RDLC reports, you can convert a textbox to placehoder.
Then right click that textbox placeholder, select placehoder properties and select HTML. Then for multiline to take effect, you have to insert <br/>
tag between those lines.