Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jasper reports 如何将小计放入多个列单元格中?_Jasper Reports_Dynamic Reports - Fatal编程技术网

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);                                          
                  }                                       
               }            
            }
         }