通过润乾的api创建报表文件
来源:互联网 发布:软件架构设计师挂靠 编辑:程序博客网 时间:2024/06/05 03:38
有的时候根不方便在报表设计工具—设计器中设计好报表文件,而是在代码中,临时创建报表文件,这里简单做个介绍:
具体代码如下:
//第一步,创建空报表模板
String reportFileHome=Context.getInitCtx().getMainDir();
ReportDefine rd = new ReportDefine2(3,3);
//第二步,设置报表属性
rd.setInput(ReportDefine.INPUT_NONE);
rd.setReportType(ReportDefine.RPT_NORMAL);
//第三步,给报表单元格写表达式
int rowCount = rd.getRowCount();
int ColCount = rd.getColCount();
for (int i = 1; i <= rowCount; i++) {
for (int j = 1; j <= ColCount; j++) {
INormalCell NCell = rd.getCell(i, (short) j);
NCell.setValue(i+j);
NCell.setBackColor(-1);
NCell.setForeColor(-65536);
rd.setBBColor(i,(short)j, -16763905); //设定下边框线色
rd.setBBStyle(i,(short)j, INormalCell.LINE_SOLID); //设定下边框类型
rd.setBBWidth(i,(short)j, (float) 0.75); //设定下边框线粗
//左边框
rd.setLBColor(i,(short)j, -16763905);
rd.setLBStyle(i,(short)j, INormalCell.LINE_SOLID);
rd.setLBWidth(i,(short)j, (float) 0.75);
//右边框
rd.setRBColor(i,(short)j, -16763905);
rd.setRBStyle(i,(short)j, INormalCell.LINE_SOLID);
rd.setRBWidth(i,(short)j, (float) 0.75);
//上边框
rd.setTBColor(i,(short)j, -16763905);
rd.setTBStyle(i,(short)j, INormalCell.LINE_SOLID);
rd.setTBWidth(i,(short)j, (float) 0.75);
}
}
//将ReportDefine保存到文件
try { ReportUtils.write(application.getRealPath(reportFileHome)+"\\testApi.raq",rd);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//第四步,运算报表
Context context = new Context();
Engine enging = new Engine( rd, context);
IReport iReport = enging.calc();
//第五步,展现
HtmlReport hReport = new HtmlReport( iReport,"report1" );
out.print(hReport.generateHtml());
这样一个简单的raq文件就生成了。
- 通过润乾的api创建报表文件
- 润乾使用api导出报表为pdf文件
- 润乾报表RAT文件的用法
- 润乾报表通过ajax实现参数的动态过滤
- 通过Web浏览器创建和渲染报表的报表控件Stimulsoft Reports.Web
- 润乾报表v4-API修改报表数据源
- 润乾报表Api后台导出报表组到PDF
- 润乾报表Api后台导出报表组到excel
- 通过API调用文件的属性对话框
- 通过 HDFS 的 API 访问文件系
- 报表文件通过JSP传参
- 报表文件通过JSP传参
- 润乾集算报表通过API修改单元格属性
- 润乾报表与DERBY数据库的创建连接详解
- API修改润乾报表sql
- 润乾报表Api导出word只读
- 润乾报表api导出word
- dev 目录文件通过udev的创建
- 利用JAX-WS RI开发JAX-WS服务
- vc++调试出现输入框:please enter the path for DBGHEAP.C的解决办法
- 背单词 1104
- Extjs学习笔记----------Panel的使用
- DrawIndexedPrimitive函数的详细解释
- 通过润乾的api创建报表文件
- Unable to instantiate Action(Action无法实例化)
- PostgreSQL9.1 PITR示例
- MAX脚本翻译教学
- 网站查找木马方法
- 使用maxscript编写max插件
- CAD时钟生成,C语言实现
- 2012-11英语学习笔记
- 教你如何使用maxscript调试器