强制Jasper HTML报告通过中间单词来换行 [英] Force Jasper HTML report to wrap text by breaking mid word

查看:127
本文介绍了强制Jasper HTML报告通过中间单词来换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jaspersoft Studio中创建了一个Jasper报告,该报告用于生成HTML报告.它的宽度为550px.数据字段之一包含URL,其中一些可能非常长,例如:

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

我遇到的问题是,生成的报告不会中断URL中间单词,即在查询字符串中字符的中间,因此文本字段被拉伸而不是固定为550px.换行是在达到&"号时进行的,而我希望它仅在达到设定宽度的字符串的任何部分进行换行.

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:

  • net.sf.jasperreports.text.truncate.at.char = true

  • net.sf.jasperreports.text.truncate.at.char = true

net.sf.jasperreports.print.keep.full.text = false

net.sf.jasperreports.print.keep.full.text = false

我在报告上尝试了以下属性:

I have tried the following property on the report:

  • net.sf.jasperreports.export.html.wrap.break.word = true

对于我尝试过的所有这些组合,输出都是相同的.

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

同一报告还用于生成PDF报告. PDF报表中的URL按照我需要的方式包装,因此HTML输出的包装方式有所不同.

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.

我正在使用Jaspersoft Studio 5.6.2.这些报告是使用JasperStarter 2.2运行的.

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

有人知道如何以所需的方式包装HTML输出吗?

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

推荐答案

来自

From JasperReport configuration reference, it seams you have to set

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

因此HTML导出程序将换行符显式添加到报表中.

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

这篇关于强制Jasper HTML报告通过中间单词来换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆