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

blank space in textbox not rendering on web reportviewer

9 Answers 230 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sunil
Top achievements
Rank 1
sunil asked on 12 Jan 2012, 07:55 AM
hi telerik,

I am showing address in a multiline textbox. you can see in the screenshot that in order to align telephone number and fax number some blank spaces are used. In the HTML Preview of the report document this spaces are neglected , when exported to pdf no problem with space . I assume this is because the html's  rendering nature  as sequence of blank space characters are treated as single space. Can you suggest me a work around.

9 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 12 Jan 2012, 09:48 AM
Hi sunil,

You're correct, this behavior is due to the fact that HTML treats multiple spaces as single space. You can either use several textboxes (one for label and another for phone/fax) or create a user function to replace the spaces with the Unicode representation of &nbsp i.e.

value.Replace(" ", "\u00A0")

that should be respected.

Greetings,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
sunil
Top achievements
Rank 1
answered on 16 Jan 2012, 06:38 AM
sorry for the late reply. I tried to replace with \u00A0 but its not working , showing the unicode character as it is. Can you please explain me the workaround more detailed .
0
Elian
Telerik team
answered on 18 Jan 2012, 03:21 PM
Hi Sunil,

As my colleague explained, you should create a custom user-function that will replace the spaces with the unicode character. If you have a textbox and you have textbox.Value = "= Fields.Telephone". Instead you create a user function, named for example ReplaceSpaces().
Then set the following value to the TextBox Value "= ReplaceSpaces(Fields.Telephone)"

and the function itself is something like this:

public string ReplaceSpaces(string text)
{
    return text.Replace(" ", "\u00A0");
}
All the best,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Donald McLean
Top achievements
Rank 2
answered on 23 Jan 2013, 07:09 PM
Your function doesn't work. I have a report with a mixed set of HTML Textboxes and regular Textboxes. I have stepped through my code and verified the correct value gets inserted into the textbox correctly however once renedered as html spaces are missing. Also when I do a view source code I can see it added more html code to data I had entered  and removed spaces. it is worth noting none were double spaces it was single spaces.
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 25 Jan 2013, 04:21 PM
Works fine for me (for regular TextBoxes not for HtmlTextBoxes). 
0
Sheeraz
Top achievements
Rank 1
answered on 23 Jun 2014, 07:19 PM
Formatting issues are very pathetic here via HTMLTEXTBOX. Spacing is not allowed. Divs are not working properly. This expensive tool is just breaking my deal with client.
0
Shiwani
Top achievements
Rank 1
answered on 17 Mar 2017, 10:55 AM

Hello, 

I created a report in telerik report designer R3 2016, and I am facing problem to show spaces or a tab before text in expression of text box.please guide me.

0
Shiwani
Top achievements
Rank 1
answered on 17 Mar 2017, 10:59 AM

Hello,

I created report in telerik report designer R3 2016 and here i am facing problem to show spaces before text in expression of text box on report browser run time. please guid me.

0
Katia
Telerik team
answered on 20 Mar 2017, 11:18 AM
Hello Shiwani,

Check an update in Facing problem to give space in text box expression forum thread - this forum post suggests an approach you can use.


Regards,
Katia
Telerik by Progress
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 Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
sunil
Top achievements
Rank 1
Answers by
Steve
Telerik team
sunil
Top achievements
Rank 1
Elian
Telerik team
Donald McLean
Top achievements
Rank 2
Hadib Ahmabi
Top achievements
Rank 1
Sheeraz
Top achievements
Rank 1
Shiwani
Top achievements
Rank 1
Katia
Telerik team
Share this question
or