Prevent line break for certain characters (whitespace, hyphen, colon)

1 Answer 26 Views
Report Designer (standalone) Report Viewer - MVC
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Stefan asked on 30 Jul 2025, 12:17 PM

We have a longer text in our report, which also contains this string "ISO 5834-1:2019", which we don't want to break into a new line.

Reporting Services seem to have the possibility to use the chr()-function to inject 'unbreakable' characters, but this doesn't seem to work in Telerik Reports.

How can we make sure, that there is no line break possible for the given string? 
(Line break in the rest of the text is ok, though.)

1 Answer, 1 is accepted

Sort by
1
Accepted
Petar
Telerik team
answered on 04 Aug 2025, 09:06 AM

Hi Stefan,

If I understand correctly, you want to ensure that the string "ISO 5834-1:2019" does not split across two lines, for example, with "ISO" appearing on one line and "5834-1:2019" on the next due to the space. To achieve this, I recommend using an HtmlTextBox item for the text, as it supports HTML entities like ` `, which represents a non-breaking space, and `‑`, which represents a non-breaking hyphen:

ISO 5834‑1:2019

For your reference, I am also attaching a muted screen recording that showcases this behavior. Could you please take a look at it and let me know if such a solution works for you?

    Regards,
    Petar
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

    Stefan
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    commented on 05 Aug 2025, 06:33 AM

    Hi Petar,

    thank you, that's working nicely. :)

     

    Kind regards.

    Stefan
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    commented on 11 Aug 2025, 09:45 AM

    Hi Petar,

    after some futher testing we discovered, that the non-breakable hyphen leads to some problems

    We encountered the following behaviour:

    • ReportViewer: hyphen is display correctly
    • Browser Print Preview & Print: hyphen is displayed as a box symbol
    • Telerik PDF Export (via RenderReport function): hypen is displayed as a box symbol
    • Telerik Print (via PrintReport function): hyphen is displayed with trailing space

    Is this known behaviour? Can we do anything about it?

    Kind regards.

    Petar
    Telerik team
    commented on 13 Aug 2025, 12:00 PM

    Hi Stefan,

    This appears to be related to the Font Requirements of the PDF Rendering. That is, the font used in the report should support the characters that would be displayed in it. However, not all fonts seem to support non-breaking hyphens (please check Where is the non-breaking hyphen in Unicode? - Microsoft Community).

    When I tried using a font that supports this special character (such as "Arial Unicode MS"), the issue was resolved:

    That said, the report viewer's preview mode is displayed using HTML, and its font substitutions are more forgiving when it comes to missing characters, possibly explaining why the non-breakable hyphen renders correctly there.

    Could you please let me know if using such a font would work for you?

    I am looking forward to your reply!

    Regards,
    Petar
    Progress Telerik

    Stefan
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    commented on 15 Aug 2025, 09:01 AM | edited

    Hi Petar,

    after switching from Arial to Segoe UI it's working now on the local machine.

    On the server it unfortunately is still showing the box symbol.

    The font is installed on the server (Windows Default?).

     

    Kind regards.

    Petar
    Telerik team
    commented on 15 Aug 2025, 10:28 AM

    Hi Stefan,

    I tried it locally, and it appears that Segoe UI does indeed support the hyphen. 

    However, since it is still rendered as a box symbol on the server, I suspect that the font may not be found there. I recommend adding the font file locally in the application that hosts the Reporting REST service. You can use the `privateFonts` configuration element in the report engine configuration to ensure that the font is loaded on the server, even if it is not available by default. Please check privateFonts Element Overview for more information on this configuration element.

    If you haven't configured the report engine before, you can refer to the following documentation article: Report Engine Configuration Overview

    Additionally, ensure that the `fontFamily` attribute in the `privateFonts` element matches the font name specified in the report definition:

    This way, it can be loaded dynamically by the report engine when it is rendering the report.

    Could you please try this approach locally and let me know how it goes?

    Regards,
    Petar
    Progress Telerik

    Stefan
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    commented on 20 Aug 2025, 06:38 AM

    Hello Petar,

    using a private font works well, thank you very much. :)

    Tags
    Report Designer (standalone) Report Viewer - MVC
    Asked by
    Stefan
    Top achievements
    Rank 2
    Iron
    Iron
    Iron
    Answers by
    Petar
    Telerik team
    Share this question
    or