问题描述
在jasper报表(iReport 4.5)中,我需要使所有表格都适合其内容宽度,下图显示了列如何包含不需要的空格
In jasper report (iReport 4.5) I need to make all table fit it's content width,Image below show how columns contain spaces which not needed
我尝试将拉伸类型"设置为相对于最高的对象",但没有用
I tried "Stretch Type" to be "Relative to tallest object" but not work
推荐答案
使用PDF格式的动态宽度有很多可能性.所有这些可能性都可能涉及开发定制软件.可以做到,但并非无关紧要.尽管列本身并不伸展",但是有几种方法-创建报表模板之前必须知道列的宽度.
There are many possibilities for dynamic widths using PDF formats. All of these possibilities will likely involve developing custom software. It can be done, but it isn't trivial. Here are a few ways, though the column does not "stretch" per se -- the width of the column must be known before the report template is created.
如果您事先知道内容和字体属性(字体,粗细,大小等),则可以计算列的宽度.
It's possible to calculate the width of the column if you know the content and the font attributes (family, weight, size, etc.) in advance.
由于JRXML文件具有简单的格式,因此可以编写Shell脚本,批处理程序或应用程序来生成.jrxml
文件.这样可以完全控制页面和列的宽度. Java代码将必须先编译.jrxml
文件,然后才能填充相应的.jasper
文件.
Since JRXML files have a straightforward format, it is possible to write a shell script, batch program, or application to generate .jrxml
files. This allows complete control over page and column widths. The Java code will have to compile the .jrxml
file before the corresponding .jasper
file can be filled.
使用 Dyanmic Jasper 创建具有动态宽度的报告.
Use Dyanmic Jasper to create reports with dynamic widths.
这篇关于如何根据内容拉伸碧玉表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!