Jasper reports 如何将小计放入多个列单元格中?
如何在多个单元格中进行小计?Jasper reports 如何将小计放入多个列单元格中?,jasper-reports,dynamic-reports,Jasper Reports,Dynamic Reports,如何在多个单元格中进行小计? 他耍了一些花招 Class ComponentPosition private static void recalculateWidth(String name, DRDesignList list, int availableWidth) throws DRException { for (int i=0;i<list.getListCells().size();i++) { DRDesignListCell listCel
他耍了一些花招
Class ComponentPosition
private static void recalculateWidth(String name, DRDesignList list, int availableWidth) throws DRException {
for (int i=0;i<list.getListCells().size();i++) {
DRDesignListCell listCell = list.getListCells().get(i);
DRDesignComponent component = listCell.getComponent();
if (component instanceof DRDesignList){
for (DRDesignComponent cp : ((DRDesignList)component).getComponents()){
Integer colSpan = colSpans.get( cp.getName() );
if (colSpan!=null){
int w = 0;
for (int j=0;j<colSpan;j++){
w += list.getListCells().get(i+j).getComponent().getWidth();
list.getListCells().get(i+j).getComponent().setWidth(0);
}
cp.setWidth(w);
component.setWidth(w);
}
}
}
}
然后是ComponentPosition.colspan.putmemeber_count.getName,3
Class ComponentPosition
private static void recalculateWidth(String name, DRDesignList list, int availableWidth) throws DRException {
for (int i=0;i<list.getListCells().size();i++) {
DRDesignListCell listCell = list.getListCells().get(i);
DRDesignComponent component = listCell.getComponent();
if (component instanceof DRDesignList){
for (DRDesignComponent cp : ((DRDesignList)component).getComponents()){
Integer colSpan = colSpans.get( cp.getName() );
if (colSpan!=null){
int w = 0;
for (int j=0;j<colSpan;j++){
w += list.getListCells().get(i+j).getComponent().getWidth();
list.getListCells().get(i+j).getComponent().setWidth(0);
}
cp.setWidth(w);
component.setWidth(w);
}
}
}
}