在Java中的jasper报告中动态增加列的宽度 [英] increase the width of a column dynamically in jasper reports in java

查看:61
本文介绍了在Java中的jasper报告中动态增加列的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在Java中动态地增加jasper报告中的列宽,我曾尝试在Java方面更改许多内容,例如读取样式表和更改值.但是在这种情况下,我不知道如何初始化将读取宽度并更改宽度的方法.

How do i increase the width of a column in jasper reports dynamically in java, i have tried changing many things in java side like reading the style sheet and changing the values. But in this case i don't know how to initialize the method which will read the width and change it.

推荐答案

假设您的报告变量名为 jasperReport

Lets say your report variable is called jasperReport

JasperReport jasperReport;

您需要获取列所在的带(JRBand).假设它位于详细信息带中:

You need to get the band (JRBand) your column is in. Assuming it is in the detail band:

JRBand band = jasperReport.getDetail();

然后找到您的列并更改其宽度:

And then find your column and change it's width:

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

这篇关于在Java中的jasper报告中动态增加列的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆