Owen Pauling
Owen Pauling

Reputation: 11871

Force Jasper HTML report to wrap text by breaking mid word

I have a Jasper report created in Jaspersoft Studio which is used to generate an HTML report. It has a width of 550px. One of the data fields contains URLs, and some of these can be very long, for example:

http://www.example.com/example?q=wifjaiojwefijawefwkopkfeomikwmfimvwkemmcwoemcomwclewccoepcopwijefijajowkopfkwoekfokwofsdvwefjijwie&fwjiejfiwjiejfiwjef&fwewfwef

The problem I am having is that the generated report does not break the URLs mid word, i.e. in the middle of the characters in the query string, so the text field is stretched rather than being fixed at 550px. The wrapping takes place when the ampersand is reached, whereas I want it to just wrap at whatever part of the string reaches the set width.

I have tried the following properties on both the field and the report:

I have tried the following property on the report:

The output was the same with all the combinations of these that I tried.

The same report is also used to generate a PDF report. The URLs in the PDF report wrap in the way I require, so it is just the HTML output that wraps differently.

I am using Jaspersoft Studio 5.6.2. The reports are run using JasperStarter 2.2.

Does anybody know how to get the HTML output to wrap in the required way?

Upvotes: 8

Views: 7063

Answers (1)

mpiffault
mpiffault

Reputation: 429

From JasperReport configuration reference, it seams you have to set

net.sf.jasperreports.text.save.line.breaks = true

so the HTML exporter explicitly add line break to the report.

Upvotes: 11

Related Questions