dynamicreports动态列

dynamicreports动态列

本文介绍了如何生成在通过Java dynamicreports动态列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了收集信息有关的客户,并生成碧玉动态报表的月度报告的应用程序。
到现在为止,我的报告显示各个领域,有的可能是空白的一些客户,并充分他人。

I wrote an app that gathers details about clients and generates a monthly report with Jasper Dynamic Report.until now , my report shows all fields, and some might be blank with some clients, and full in others.

我要作出这样的选择只有非空列为每个客户端动态报表。
要完成,我已经创建了数组:

I want to make a dynamic report that chooses only the non empty columns for each client.to accomplish that I have created arrays for :

aggregationSubtotalBuilder,
TextColumnBuilder,
ConditionalStyleBuilder,
StyleBuilder,

aggregationSubtotalBuilder,TextColumnBuilder,ConditionalStyleBuilder,StyleBuilder,

所以不是这样

TextColumnBuilder<Double> offLine  = col.column "OffLine","offline",type.doubleType());
TextColumnBuilder<Double> onLine   = col.column("OnLine","online",type.doubleType());



...

即时通讯做这样的:

for (int i = 0; i < activeColumns.length; i++)
  {
     activeColumnsForDataSource[i] = activeColumns[i];
     textColumnBuilder[i] = col.column("\"" + activeColumnsForDataSource[i] + "\"","\"" + activeColumns[i] + "\"",type.doubleType()).setTitleFixedHeight(30);
     conditionStyleBuilder[i] = stl.conditionalStyle(cnd.unEqual(textColumnBuilder[i], 0)).setFontSize(12).bold();
     styleBuilder[i] = stl.style().conditionalStyles(conditionStyleBuilder[i]).setBorder(stl.pen1Point());

     textColumnBuilder[i].setStyle(styleBuilder[i]).setHorizontalAlignment(HorizontalAlignment.CENTER);
     aggregationSubtotalBuilder[i] = sbt.sum(textColumnBuilder[i]).setLabel("סהכ" + activeColumns[i]).setLabelStyle(sumLabelStyle).setStyle(dataNameStyle);

,其中activeColumns是所有活动的列我想补充的名字的数组。

where "activeColumns" is an array with the names of all active columns I want to add.

我有麻烦的问题之一是,我有一个日期列,应始终显示,它是一个字符串类型:

one of the issues I have trouble with is that I have a Date column, that should always be displayed, and it is of a string type:

TextColumnBuilder<String> dayDate  = col.column("תאריך","date",type.stringType()).setStyle(rowNamesStyle);

所以我不能将它添加到阵列TextColumnBuilder。
我怎么能添加到报表?

so I cannot add it to the TextColumnBuilder Array .how can I add it to the report?

在构建()
如果我做这样的事情。

in the build()if I do something like this

.columns(//add columns
             textColumnBuilder,dayDate)
       .columnGrid(
             textColumnBuilder,dayDate)

它只会显示我加的最后一个项目,这是的DayDate。

it will only show the last item I added , which is DayDate.

我该怎么办?

请帮帮忙!

感谢您。

戴夫。

推荐答案

列(textColumnBuilder).addColumn(的DayDate)

columns(textColumnBuilder).addColumn(dayDate)

和删除ColumnGrid。

and remove the ColumnGrid.

现在它的工作:)

这篇关于如何生成在通过Java dynamicreports动态列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 18:51