quento
quento

Reputation: 1114

jasperreports html split text without whitespaces

String example:

"fooTextExmaple" x 100

So, it looks like one large word without whitespaces.

I have no problems with same strings in pdf, however, I have problems dealing with large text without whispaces while exporting to HTML.

It looks like long row which does not fit any fixed width. The row's width would change dynamically by adding new chars without whitespaces to this string:

enter image description here

Is there any way to deal with this problem?

EDIT:

The way like it does not work:

 PrintWriter out = resp.getWriter();
                resp.setContentType("text/html");
                req.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, print);
                exporter = new HtmlExporter();

                SimpleHtmlReportConfiguration configuration = new SimpleHtmlReportConfiguration();
                configuration.setWrapBreakWord(true);
                exporter.setConfiguration(configuration);

                exporter.setExporterInput(new SimpleExporterInput(print));
                SimpleHtmlExporterOutput output = new SimpleHtmlExporterOutput(out);
                String[] uriParts = req.getRequestURI().split("/");
                output.setImageHandler(new WebHtmlResourceHandler("/" + uriParts[1] + "/image?image={0}"));
                exporter.setExporterOutput(output);
                exporter.exportReport();

Upvotes: 0

Views: 949

Answers (1)

dada67
dada67

Reputation: 5113

Set the net.sf.jasperreports.text.save.line.breaks property to true.

Read more about it at http://jasperreports.sourceforge.net/config.reference.html

The net.sf.jasperreports.export.html.wrap.break.word property is supposed to help as well, but it only works in some browsers.

Upvotes: 1

Related Questions