如何将小计放在多个列单元格中?
How to put Subtotal in multiple col cells?
如何在多个单元格中放入小计?
AggregationSubtotalBuilder totalBase = sbt.sum(total_, config.getColumn("base").getCol());
AggregationSubtotalBuilder member_count = sbt.text("Total Employes :", config.getColumn("code").getCol());
jrb.subtotalsAtGroupFooter( emp_number_group, member_count, totalBase );
使用了一些技巧
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.colSpans.put(memeber_count.getName(), 3);
如何在多个单元格中放入小计?
AggregationSubtotalBuilder totalBase = sbt.sum(total_, config.getColumn("base").getCol());
AggregationSubtotalBuilder member_count = sbt.text("Total Employes :", config.getColumn("code").getCol());
jrb.subtotalsAtGroupFooter( emp_number_group, member_count, totalBase );
使用了一些技巧
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.colSpans.put(memeber_count.getName(), 3);