| 吼吼,解决了,先在设计器中制作个空模板a.cpt(即只有表头),在程序中读取这张空模板a.cpt,给它赋值,最后生成一个新的报表b,输出即可,重要代码如下: Env oldEnv = FRContext.getCurrentEnv();
 String envPath = oldEnv.getPath();
 File cptFile = new File(envPath+"replortlets\\test\\emptyModel.cpt");//先获取一张空模板
 。。。。。
 最后FileOutputStream outputStream = new FileOutoutStream(new File(envPath+"\\reportlets\\test\\newModel.cpt"));//输出一张新的模板
 TemplateExporter templateExporter = new TemplateExporter ();
 templateExporter .export(outputStream ,workbook);
 |