润乾报表v4-导出xml文件
来源:互联网 发布:数据录入员工作职责 编辑:程序博客网 时间:2024/05/16 06:34
最近一段时间在解决客户问题的过程中,有些客户想把润乾报表导出到xml文件中,以方便可以在其他地方使用这些数据,而目前润乾报表没有直接可以导出xml的标签,所以就只能用API来实现将报表导出到xml的需求。
润乾报表的API中有一个XMLReport对象,这个对象就是处理润乾报表与XML文件关系的,所以要将润乾报表导出成xml可以从这个对象入手。下面就用润乾报表的API实现上面的需求。
首先读入一个报表模板(报表模板的数据已经内建),然后构建报表的运算环境、设置报表授权,装载报表引擎,最后计算,生成IReport对象,对应的代码如下:
ReportDefine rd = (ReportDefine)ReportUtils.read(“F:/qwer.raq”);
Context ctx = new Context();
Engine engine = new Engine(rd,ctx);
ExtCellSet.setLicenseFileName(“D:/安装文件/润乾安装/License4.0[64100621100826_640000]/技术应用中心专用授权Server2010-12-31V4.0Windows.lic”);
IReport ireport = engine.calc();
然后构造一个XMLReport对象,把IReport对象写到一个本地的流中,这个流指向一个xml文件,对应的代码为:
XMLReport xmlreport = new XMLReport();
xmlreport.export(ireport);
FileOutputStream fos = new FileOutputStream(“F:/TEST1.xml”);
xmlreport.saveTo(fos);
fos.flush();
fos.close();
最后如果要导出xml的话只需要执行上面的代码就可以了,完整的API代码如下:
import java.io.FileOutputStream;
import com.runqian.report4.model.ReportDefine;
import com.runqian.report4.model.engine.ExtCellSet;
import com.runqian.report4.usermodel.Context;
import com.runqian.report4.usermodel.Engine;
import com.runqian.report4.usermodel.IReport;
import com.runqian.report4.util.ReportUtils;
import com.runqian.report4.view.xml.XMLReport;
public class Test
{
public export() throws Exception{
ReportDefine rd = (ReportDefine)ReportUtils.read(“F:/qwer.raq”);
Context ctx = new Context();
Engine engine = new Engine(rd,ctx);
ExtCellSet.setLicenseFileName(“D:/安装文件/润乾安装/License4.0[64100621100826_640000]/技术应用中心专用授权Server2010-12-31V4.0Windows.lic”);
IReport ireport = engine.calc();
XMLReport xmlreport = new XMLReport();
xmlreport.export(ireport);
FileOutputStream fos = new FileOutputStream(“F:/TEST1.xml”);
xmlreport.saveTo(fos);
fos.flush();
fos.close();
}
public static void main(String[] args) throws Exception {
Test test = new Test();
Test.export();
}
}
这样通过上面的代码就能把润乾报表导出到xml文件中,上面所说的需求也就实现了。
- 润乾报表v4-导出xml文件
- 润乾报表v4-展现报表同时后台导出excel
- 润乾报表v4将sql和参数输出到xml文件中
- 润乾报表v4 - 导出txt内容对齐
- 润乾报表V4大数据api分批导出excel
- 润乾报表v4-API导出EXCEL删除报表某一行或列
- 润乾报表导出txt文件
- web报表导出成XML文件
- 润乾报表v4-自动导入excel
- 润乾报表(reportConfig.xml文件说明)
- 润乾报表v4-API修改报表数据源
- 润乾报表v4-调整报表内文字行间距
- 润乾报表v4-domino集成报表的方案
- 润乾报表v4-JAVA APPLICATION下报表应用
- 润乾报表V4在weblogic下部署找不到授权文件的解决方法
- 润乾报表v4中sql和参数信息输出到指定文件
- 润乾使用api导出报表为pdf文件
- C# 获取文件信息并导出Excel,Xml报表
- android中使用adb shell命令kill掉应用程序
- Mark一下linux下较快的软件源
- YII些项目之Javascript
- LayerMask 的使用
- 测试配置工具-ExpanDrive
- 润乾报表v4-导出xml文件
- 百度地图:第一篇HelloWorld
- mysql中tinyint、smallint、int
- cdn内容分发网络介绍
- 九、Nio之DatagramChannel
- 基于stm32单片机的可调节pwm输出
- Visualizing and Understanding Convolutional Networks
- NSTimer循环引用不释放问题
- 关于EL表达式中requestScope和param区别