润乾集算报表应用开发之直接导出Excel/PDF文件
来源:互联网 发布:婴儿床 知乎 编辑:程序博客网 时间:2024/05/19 09:14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package com.runqian.servlet;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.raqsoft.report.model.ReportDefine;
import com.raqsoft.report.usermodel.Context;
import com.raqsoft.report.usermodel.Engine;
import com.raqsoft.report.usermodel.IReport;
import com.raqsoft.report.usermodel.ParamMetaData;
import com.raqsoft.report.util.ReportUtils;
publicclassExportToExcel extends HttpServlet {
/**
* Constructor of the object.
*/
public ExportToExcel() {
super
();
}
/**
* Destruction of the servlet. <br>
*/
publicvoid destroy() {
super
.destroy();
// Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has itstag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
publicvoiddoGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException {
Stringreport = request.getParameter(
"rpx"
);
Stringyear = request.getParameter(
"year"
);
//保证报表名称的完整性
int iTmp = 0;
if
( (iTmp =report.lastIndexOf(
".rpx"
)) <= 0 ){
report= report +
".rpx"
;
iTmp= 0;
}
StringreportFile = request.getSession().getServletContext().getRealPath(
"/reportFiles/"
+report);
Contextcxt = newContext();
try
{
ReportDefinerd = (ReportDefine)ReportUtils.read(reportFile);
cxt.setParamValue(
"year"
, year);
Engineengine = newEngine(rd, cxt);
//构造报表引擎
IReportiReport = engine.calc();
//运算报表
ReportUtils.exportToExcel(
"D:\\result.xls"
,iReport,
true
);
}
catch
(Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has itstag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
publicvoiddoPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException {
response.setContentType(
"text/html"
);
PrintWriterout = response.getWriter();
out.println(
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML4.01 Transitional//EN\">"
);
out.println(
"<HTML>"
);
out.println(
" <HEAD><TITLE>A Servlet</TITLE></HEAD>"
);
out.println(
" <BODY>"
);
out.print(
" This is"
);
out.print(
this
.getClass());
out.println(
", using the POST method"
);
out.println(
" </BODY>"
);
out.println(
"</HTML>"
);
out.flush();
out.close();
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
publicvoid init() throws ServletException {
// Put your code here
}
}
0 0
- 润乾集算报表应用开发之直接导出Excel/PDF文件
- 润乾集算报表应用开发之直接导出Excel/PDF文件
- Excel PDF报表的导出
- 报表开发之批量导入导出Excel
- 报表开发之批量导入导出Excel
- 用rdlc文件直接导出到excel或PDF
- 应用springMVC快速开发PDF/EXCEL报表方案及实现
- 应用springMVC快速开发PDF/EXCEL报表方案及实现
- java操作office和pdf文件(四)页面列表导出cvs,excel、pdf报表.
- java操作office和pdf文件(四)页面列表导出cvs,excel、pdf报表.
- java操作office和pdf文件页面列表导出cvs,excel、pdf报表.
- 水晶报表导出PDF or Excel
- 页面列表导出cvs,excel、pdf报表
- 水晶报表导出PDF or Excel
- BIRT报表工具,直接导出EXCEL
- Java程序员从笨鸟到菜鸟之(一百零六)java操作office和pdf文件(四)页面列表导出cvs,excel、pdf报表.
- Java程序员从笨鸟到菜鸟之(一百零六)java操作office和pdf文件(四)页面列表导出cvs,excel、pdf报表.
- 水晶报表导出PDF or Excel,并返回文件到用户的IE浏览器中
- 深度学习笔记三:反向传播(backpropagation)算法
- css背景透明内容不透明处理
- 学习阶段一点想法和感受
- Thread、Runnable、线程状态转换、线程调度、常用函数说明.md
- Android 时间同步原理分析
- 润乾集算报表应用开发之直接导出Excel/PDF文件
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- epf配色方案如何导入到Eclipse
- 欢迎使用CSDN-markdown编辑器
- 初来乍到
- laravel框架session使用教程
- iOS - 代理协议,正向或逆向传值,属性传值的简单实用
- kubernetes1.5即将发布
- Laravel 5.1 中 Session 数据存储、访问、删除及一次性Session实例教程