来自XML的Crystal报告 [英] Crystal report from XML

查看:96
本文介绍了来自XML的Crystal报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VB.Net(2003)项目,它有一个简单的Crystal Report。
报告显示.XML文件中包含的数据。

I have a VB.Net (2003) project that has a simple Crystal Report.  The
report displays data contained in an .XML file.

使用向导,我能够正确地进行移位。

Using the wizard, I was able to get it to displaty properly.


问题是,我希望用户能够选择.XML
文件(格式相同)并让报告动态显示其< BR>内容。


The problem, is that I would like the user to be able to choose an .XML
file (of the same format) and have the report dynamically display its
contents.


我无法弄清楚如何在运行时更改它在
上报告的.xml文件。


I cannot figure out how to change the .xml file that it reports on
during runtime.

任何人都可以在这方面帮助我吗?

Can anyone help me in this aspect?

推荐答案

最简单的方法这是使用报告文档模型。

The easiest way to do this is to use the Report Document model.

即。如果您在应用程序中创建的报表名为CrystalReport1,则可以执行以下操作:

ie.  If your report you created in your application is called CrystalReport1 you would do the following.

VB.NET

将myReport作为新的CrystalReport1
Dim ds作为新数据集
ds.ReadXML(" myxmlfile.xml",XmlReadMode.ReadSchema)'将xml读取到数据集
myReport.SetDataSource(ds)'将数据集传递给报告

Dim myReport As new CrystalReport1
Dim ds As new Dataset
ds.ReadXML("myxmlfile.xml", XmlReadMode.ReadSchema) 'read the xml to a dataset
myReport.SetDataSource(ds) 'pass the dataset to the report

然后将它放到查看器中

CrystalReportViewer1.ReportSource = myReport

CrystalReportViewer1.ReportSource = myReport


这篇关于来自XML的Crystal报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆