This is a migrated thread and some comments may be shown as answers.

newline inside table cell

8 Answers 1311 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lorenzo
Top achievements
Rank 1
Lorenzo asked on 04 Mar 2010, 04:34 PM
Hi,
I'm trying to format the content to visualized inside a cell of my CrossTab (....which is actually as Table) so that it is disposed in two lines:
Ex.
=Fields.FirstName + "<br>" + Fields.LastName 
This works fine when I see the report inside ReportViewer (Actually the Web version since I'm working in ASP.NET) in the sense that I can see First Name and Last Name on two different lines, but when I export it to PDF format I see the plain text...including the HTML TAG !

How can I achieve a "newline" that works in PDF also ?

Many Thanks

Lorenzo

8 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 05 Mar 2010, 07:10 PM
Hi Lorenzo Raimondi,

Using a <br> as a new line would work in the web viewer as it is the browser that handles the HTML. Using enter in your expression value would generate a new line for you, which in code behind would be serialized as

textBox1.Value = "line1\r\nline2";

and would be respected in all supported export formats.

All the best,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lorenzo
Top achievements
Rank 1
answered on 11 Mar 2010, 11:42 AM
Hi, sorry for late response, I was away.
I've tried this morning but without success.
The attempts I made inside the .Designer.vb were:
Me.TextBox6.Value = "=Fields.ProfFamily\r\nFields.Knowledge" 
Me.TextBox6.Value = "=Fields.ProfFamily \r\n Fields.Knowledge" 
Me.TextBox6.Value = "Fields.ProfFamily\r\nFields.Knowledge" 
 
In all cases I get en error:

An error has occurred while processing TextBox 'TextBox6': 
Missing operand before \r operand. 

no luck !


0
Steve
Telerik team
answered on 12 Mar 2010, 05:54 PM
Hi Lorenzo Raimondi,

What you have tried is incorrect as you cannot display the values of two different fields directly in an expression. To achieve this you should either concatenate the values i.e.:

Me.TextBox6.Value = "=Fields.ProfFamily + \"\r\n\" + Fields.Knowledge"

or use embedded expression:

Me.TextBox6.Value = "{Fields.ProfFamily}\r\n{Fields.Knowledge}"

Sincerely yours,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Brad Younge
Top achievements
Rank 1
answered on 27 Oct 2010, 10:05 PM
I'm trying to get a NewLine into a textbox using the Expression Editor in the Designer and can't get it to work.  I've tried the following:

=Fields.Street1 + "\r\n" + Fields.Street2
=Fields.Street1 + "\\r\\n" + Fields.Street2
=Fields.Street1 + "<br>" + Fields.Street2

The third one works in the Report Viewer, but not when Exported to PDF.

Please Help.
Thanks!
0
Steve
Telerik team
answered on 28 Oct 2010, 08:48 AM
Hi Brad,

You have not tried neither of my suggestions from previous post which both work as expected. Note that they are the actual code generated for the Value property and not the actual value set in the expression editor.

Best wishes,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ken Lewis
Top achievements
Rank 1
answered on 24 Jan 2011, 11:46 PM
I got this to work using the "embedded expression" example in the ItemDataBinding event. Is it possible to get the same result using the expression editor or do we have to use code?

Thanks,

Ken
0
Steve
Telerik team
answered on 25 Jan 2011, 10:24 AM
Hi Ken,

The code I've provided in my post from 3/12/2010 is taken from the InitializeComponent method which as you probably know is auto generated by the report designer i.e. I have entered those expressions in the expression editor of the textBox item. Sample video is attached to clear any further confusion on this topic.

Best wishes,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Ken Lewis
Top achievements
Rank 1
answered on 25 Jan 2011, 03:44 PM
Hi Steve,

The video helped a lot. What I wasn't getting was that I could simply use the enter key in the expression editor. (I missed that in Peter's March 5, 2010 post.)

Thanks!

Ken
Tags
General Discussions
Asked by
Lorenzo
Top achievements
Rank 1
Answers by
Peter
Telerik team
Lorenzo
Top achievements
Rank 1
Steve
Telerik team
Brad Younge
Top achievements
Rank 1
Ken Lewis
Top achievements
Rank 1
Share this question
or