字符串示例:
“ fooTextExmaple” x 100
因此,它看起来像一个没有空格的大字。
我在使用pdf中的相同字符串时没有问题,但是在导出到HTML时,在处理不带空格的大文本时遇到了问题。
看起来像长行,不适合任何固定宽度。通过向此字符串添加不带空格的新字符,行的宽度将动态变化:
有什么办法可以解决这个问题?
编辑:
像这样的方式行不通:
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();
将该net.sf.jasperreports.text.save.line.breaks
属性设置为true
。
在http://jasperreports.sourceforge.net/config.reference.html上了解有关它的更多信息。
该net.sf.jasperreports.export.html.wrap.break.word
属性应该也可以提供帮助,但是它仅在某些浏览器中有效。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句