使用CrystalReportViewer如何查看rpt文件而不是数据库中的数据?
使用 CrystalReportViewer 如何在过滤后查看 rpt 文件中的数据,而不是进入数据库获取数据。 rpt 文件已包含所有数据。我正在研究java。
这是我在jsp中的代码。我需要做出哪些改变?
// ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************
{
// Create the CrystalReportViewer object
CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
String reportSourceSessionKey = reportName+"ReportRerunSource";
Object reportSource = session.getAttribute(reportSourceSessionKey);
reportSource = clientDoc.getReportSource();
session.setAttribute(reportSourceSessionKey, reportSource);
// set the reportsource property of the viewer
crystalReportPageViewer.setReportSource(reportSource);
// Apply the viewer preference attributes
crystalReportPageViewer.setOwnPage(true);
crystalReportPageViewer.setHasLogo(true);
crystalReportPageViewer.setEnableParameterPrompt(false);
crystalReportPageViewer.setHasToggleParameterPanelButton(false);
// Process the report
crystalReportPageViewer.processHttpRequest(request, response, application, null);
}
// ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************
Using CrystalReportViewer how to view data from the rpt file after filtering and NOT go in the database for fetching the data. The rpt file already contains all data. I am working on java.
here is my code in jsp. What changes do i need to make?
// ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************
{
// Create the CrystalReportViewer object
CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();
String reportSourceSessionKey = reportName+"ReportRerunSource";
Object reportSource = session.getAttribute(reportSourceSessionKey);
reportSource = clientDoc.getReportSource();
session.setAttribute(reportSourceSessionKey, reportSource);
// set the reportsource property of the viewer
crystalReportPageViewer.setReportSource(reportSource);
// Apply the viewer preference attributes
crystalReportPageViewer.setOwnPage(true);
crystalReportPageViewer.setHasLogo(true);
crystalReportPageViewer.setEnableParameterPrompt(false);
crystalReportPageViewer.setHasToggleParameterPanelButton(false);
// Process the report
crystalReportPageViewer.processHttpRequest(request, response, application, null);
}
// ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一次检索时,您需要将所需的全部值存储在数据集中,然后将报表查看器的源设置为数据集。
数据集中存在的值可以通过以下方式加载到报告视图中:
数据库专家-->创建新连接 -->连接到服务器并右键单击添加新命令,添加命令后,您在命令中给出的每一列都会出现,因此您可以通过从字段资源管理器拖放到报告查看器来显示它们。
希望它能帮助你。
You need to store the entire values what you required in a Dataset when you retrieve at first, and later setting the Report viewer's source to the Dataset.
The values present in the Dataset can be loaded to the Report view by going,
Database Expert --> Create New Connection --> Connect to the Server and on right clicking add a new Command, after adding the command the every column you have given in the Command will appear, so you can display them by dragging and dropping from the Field Explorer to the Report Viewer.
Hope it will help you.