How to Stretch Jasper Table Columns based on Conte

2019-09-15 02:12发布

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

enter image description here

1条回答
ら.Afraid
2楼-- · 2019-09-15 02:43

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.

Dynamic Template

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.

Dynamic Jasper

Use Dyanmic Jasper to create reports with dynamic widths.

查看更多
登录 后发表回答