19 Answers, 1 is accepted
In Q1 2009, we've released a new report item - HtmlTextBox. You can use it as a replacement for the standard textbox item and the following would be formatted properly for all formats except excel (yet to come):
line 1 <br />line 2 <br />line 3
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
As a quick follow up I've just tried this with the TextBox item and it works as expected e.g.:
private void textBox1_ItemDataBound(object sender, EventArgs e) |
{ |
Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender; |
txt.Value = "line 1 \r\n line 2 \r\n line 3"; |
} |
Of course this would not work in the Expression editor as it escapes the \r\n characters, but I assumed that you're doing it in code since you've explicitly stated that you do not want this in the expression editor. However it is possible to add this event through the expression editor by pressing enter whenever you want a new line to start and if you check how it is serialized in the InitializeComponent() method, you would notice that the code is the same as the code snippet above.
Greetings,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
It would seem that you have not reviewed my last reply to Boots in this thread. Using Enter in the TextBox expression editor would create a new line.
Best wishes,
Steve
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
That is probably because you're using an older version of the product. Try Ctrl + Enter or you can even edit the Value of the TextBox directly in the InitializeComponent() method i.e.:
textBox1.Value = "line 1 \r\n line 2 \r\n line 3";
Regards,
Steve
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
We would not trim anything out of the box, but you can try using the built-in Trim function.
Best wishes,
Steve
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
And there must be Grouping option for elements, so that multiple elements on the reports can be moved at a time.
Not sure if that can be done or not.
I tried adding an HTML Text box at the the Group Footer and have its value <br/> but that did not work.
Can you please direct me to what I need to do or provide me with an example.
Thanks
It seems you talk about breaks before and after report sections. This functionality is handled by the PageBreak property of report sections.
Kind regards,
Steve
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
I was wondering if I can do a line break not a page break so leave a few lines between each report section.
You cannot, all report sections are right after the other. For more info see:
Greetings,
Steve
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
i am using Telerik_Reporting_Q2_2012, i used HTMl text box for line breaks but, it not working.
i used like this:
line1<br/>line2<br/>line3<br/> .
but it's displayed like this when i run the report. : line1<br/>line2<br/>line3<br/> .
can u give suggestion for this problem
Thanks in Advance
Siva
Please make sure that you input the HTML code in the Html view and not in the Design view. By default the HtmlTextBox editor starts in the Design view where you enter text and format it using the provided tools; switching to the Html view (the button is situated in the upper left part of the expression builder) you can edit the markup.
Regards,
IvanY
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
public static string BR()
{
return Environment.NewLine;
}
Then you can put this straight in your expression and you can eliminate ItemBinding events or HtmlTextBoxes just for linebreaks.
"=First Line" + BR() + "Second Line" + BR() + "Third Line"
It would be a cool feature if you can define your own Report Constants or Report Level properties that could be read from the Expressions. Static methods are great, but sometimes you need to evaluate against a handful of values that do not exists on the bound ReportItem.
I always include these in my reports to simplify my expression
public
static
bool
FIND(
object
rawValue,
string
values)
{
string
value = Trim2(rawValue);
return
values.Split(
','
).Contains(value)
}
public
static
string
BR()
{
return
Envionment.NewLine;
}
public
static
string
Trim2(
object
rawValue)
{
return
(rawValue +
""
).Trim();
}
public
static
int
Len2(
object
rawValue)
{
return
(rawValue +
""
).Trim().Length;
}
public
static
string
CleanHtml(
string
rawHtml)
{
// Uses HtmlAgilityPack to cleanup messy html to xhtml
return
ReportHelper.CleanHtml(rawHtml);
}
You can use '<br/>' or replace char(10) by '<br />' in your sql query and then use HtmlDecode function in your report html box expression:
SELECT
Comments +
'<br/>'
{HtmlDecode(Fields.Comments)}
This will work perfectly.
Madani
In case anyone needs another solution. I wanted two concatenated fields to appear on separate lines in a Telerik Grid then a report but the report could be PDF or exported to Excel. This meant I could not use HtmlTextBox.
So I concatenated the fields using a <br/> which works really well for the grid but then I created a little C# function to replace the <br/> with \r\n as expressions allow for C# functions. Below is the code:
public static string formatBR(object s)
{
string temp;
temp = MNS(s);
temp = temp.Replace("<br/>", "\r\n");
return temp;
}
Here is the expression:
= Online_Reporting.Utilities.formatBR(Trim(Fields.Comments))
This technique has gotten me around many little limitations that I was just too lazy to figure out.
Hope it helps someone.
ROD>