Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:28:19+00:00 2026-06-11T21:28:19+00:00

I have a JasperReports template that contains a textField element that will contain a

  • 0

I have a JasperReports template that contains a textField element that will contain a variable length of strings. If the string is too long to fit the width, it’ll be split which is fine except when the string contains a hyphen or a space char. In this case the string is split from that char. Below are some example of what’s the input, observed outcome and wanted outcome + summary to make my point easier to understand.

input      observed   wanted   summary
_____________________________________
overflow  -> overfl -> overfl : OK
over flow -> over   -> over f : NOT OK
over-flow -> over-  -> over-f : NOT OK

Setting the reportElement to have isStretchWithOverflow=”true” attribute will split the text on two lines, but this is not wanted behaviour.

Is there anyway to fix this?

Thanks.

EDIT: The input data comes from an external source, so I cannot directly change that. I ran some tests and noticed that using non-breaking space will do for spaces. non-breaking hyphen on the other hand is not printed at all, i.e. text ‘over-flow’ becomes ‘overflow’. Not quite what is wanted.

Despite the input source not in my control, I could fix this problem by writing a Scriptlet that’ll change spaces to non-breaking spaces and hyphens to non-breaking hyphens, only if those darn non-breaking hyphens would be printed.

Printing to PDF by the way, in case that gives some hints of the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:28:20+00:00Added an answer on June 11, 2026 at 9:28 pm

    It’s a font issue. Non-breaking hyphen works(\u2011) fine, when the font supports it. See fonts sample on how load other than the default font (DejaVu Sans for example).

    If anyone has a better option for the input source modification than the Scriptlet, please let me know.

    (Marking my own answer as correct in order to get this topic closed.)

    EDIT: Have to wait for two days in order to mark this answer correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java application that is generating JasperReports. It will create as many
I have a JasperReport template (generated on the Server) with a Styled Textfield (RTF).
I have some utf-8 characters in jasperreports template. In iReport editor everything fine. But
I have a reporting system where occasionally there will be multiple JasperReports in a
I have some code that will read a jrxml file into a JasperDesign object.
I'm working with JasperReports 3.2. I have a report that I export to PDF
I have configured JasperReports successsfully on Spring MVC . The problems is that when
For example I have such strings in ResourceBundle: some.string.1=String 1 some.string.2=String 2 some.string.3=String 3
I have developed web application which uses JasperReports for reporting purpose. In that I
I have web application that uses JasperReports for PDF report generation. I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.