blank space in textbox not rendering on web reportviewer

7 posts, 0 answers
  1. sunil
    sunil avatar
    8 posts
    Member since:
    Mar 2011

    Posted 12 Jan 2012 Link to this post

    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.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 12 Jan 2012 Link to this post

    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!

  3. DevCraft banner
  4. sunil
    sunil avatar
    8 posts
    Member since:
    Mar 2011

    Posted 16 Jan 2012 Link to this post

    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 .
  5. Elian
    Admin
    Elian avatar
    435 posts

    Posted 18 Jan 2012 Link to this post

    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!

  6. Donald McLean
    Donald McLean avatar
    20 posts
    Member since:
    May 2010

    Posted 23 Jan 2013 Link to this post

    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.
  7. Hadib Ahmabi
    Hadib Ahmabi avatar
    181 posts
    Member since:
    Nov 2011

    Posted 25 Jan 2013 Link to this post

    Works fine for me (for regular TextBoxes not for HtmlTextBoxes). 
  8. Sheeraz
    Sheeraz avatar
    27 posts
    Member since:
    Nov 2012

    Posted 23 Jun 2014 in reply to Hadib Ahmabi Link to this post

    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.
Back to Top
DevCraft banner