Dynamically increase column width in jasper reports in java

How to increase the column width in jasper reports dynamically in java, I tried to change many things in the java side, like reading a stylesheet and changing values. But in this case, I don’t know how to initialize a method that will read the width and change it.

+3
source share
2 answers

Suppose your report variable is called jasperReport

JasperReport jasperReport;

You need to get the group (JRBand) that your column is in. Assuming it is in the detailed range:

JRBand band = jasperReport.getDetail();

And then find your column and change its width:

JRElement column = band.getElementByKey("key_for_column");
column.setWidth(123);
+1
source

This path column will use the full page width.

myReport.addColumn(myColumn);
myReport.setTitle("column should use full width available");
myReport.setUseFullPageWidth(true); //make colums to fill the page width
0

Source: https://habr.com/ru/post/1714113/


All Articles