java打印报表的实现?

如题~~~... 如题~~~ 展开
 我来答
匿名用户
2013-11-08
展开全部
<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*"%>
<%@ page import = "com.crystaldecisions.sdk.plugin.desktop.common.*"%>
<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*"%>
<%@ page import = "com.crystaldecisions.sdk.framework.*"%>
<%@ page import = "com.crystaldecisions.sdk.occa.security.*"%>
<%
IInfoStore iStore=null;
IInfoObjects oInfoObjects=null;
IInfoObject oInfoObject=null;
IEnterpriseSession es = null;
String user = request.getParameter("username");
String password = request.getParameter("password");
String apsName = request.getParameter("apsname");
String apsAuthType = request.getParameter("authType");

// Logon and obtain an Enterprise Session
es = CrystalEnterprise.getSessionMgr().logon(user, password, apsName, apsAuthType);
%>
<%
//Grab the InfoStore from the httpsession
iStore = (IInfoStore) es.getService("", "InfoStore");
//Query for the report and make sure that the report is an instance "SI_INSTANCE=0"
oInfoObjects = (IInfoObjects) iStore.query("Select * from CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report' And SI_INSTANCE=0 And SI_NAME='Consolidated Balance Sheet'" );
//retrieve the latest instance of the report
oInfoObject = (IInfoObject) oInfoObjects.get(0);
out.println(oInfoObject.properties().getProperty("SI_ID"));
//Pass the report and InfoObject to the session for the viewer page.
session.setAttribute( "infoObject", oInfoObject );
session.setAttribute( "enterpriseSession", es );
response.sendRedirect( "viewer.jsp" );
%>
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setReportSourceClassFactoryName("com.crystaldecisions.sdk.occa.report.application.reportsourcefactory.PSReportSourceFactory");
viewer.setReportSource(oInfoObject); //the new instance of the report
viewer.setEnterpriseLogon(es); //pass the current enterprise session object
viewer.setOwnPage(true);
viewer.setName("View Report"); //Name of HTML page containing viewer
//View the report
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式