gpt4 book ai didi

jasper-reports - 如何打印拆分为多页的列

转载 作者:行者123 更新时间:2023-12-05 01:32:08 25 4
gpt4 key购买 nike

我有一份报告 5 columns .
我想把它分成2 pages .

Page APage BPage A会像这样:

|| No  || Col 1  || Col 2 || Col 3 || 
-------------------------------------
|| 1 || || || ||
|| 2 || || || ||

虽然 Page B会像这样:
|| No || Col 4 || Col 5 ||
--------------------------
|| 1 || || ||
|| 2 || || ||

所以每次打印时,我都希望页面去 AB , AB , AB .
我试图做两份报告。

第一份报告包含 Page A ,第二份报告包含 Page B .
我将子报告放在链接到第二个报告的第一个报告中。

但是,当我打印时,打印出来的页面就像 AAAABBBB
如何将打印的页面设置为 AB , AB , AB ?

最佳答案

好问题。你有源代码/模型吗?你是如何对databean建模的?
我将示例模型放在下面以供引用。

public class DataBean {
private String name;
private String school;
private List<SubReportBean> subReportBeanList;
//getters and setters

}


public class SubReportBean {

private String address;
private String city;
//getter and setter
}

public class DataBeanList {
public ArrayList<DataBean> getDataBeanList() {

// Create sub report data
SubReportBean subBean1 = new SubReportBean();
//set subbean1
SubReportBean subBean2 = new SubReportBean();
//set subbean2
SubReportBean subBean3 = new SubReportBean();
//set subbean3

ArrayList<DataBean> dataBeanList = new ArrayList<DataBean>();

// Create master report data
dataBeanList.add(generate("John", "xyz school",
Arrays.asList(subBean1)));
dataBeanList.add(generate("somename", "nice school",
Arrays.asList(subBean2)));
dataBeanList.add(generate("somename1", "cA school",
Arrays.asList(subBean1)));


return dataBeanList;
}


private DataBean generate(String name, String school,
List<SubReportBean> subBean) {
DataBean dataBean = new DataBean();

dataBean.setName(name);
dataBean.setSchool(school);
dataBean.setSubReportBeanList(subBean);

return dataBean;
}
}

关于jasper-reports - 如何打印拆分为多页的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38115085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com