2014-01-25 52 views
0
ReportDocument rptdoc = new ReportDocument(); 

rptdoc.Load(@"D:\Tasks\Reports\example.rpt"); 

rptdoc.Load(Path\\example.rpt"); 

此路径应该从system.Path获得一些字符串变量。 在此代码中,我直接编写了路径,但是我不应该将路径写为静态。它应该从系统中获取。 我正在使用Windows应用程序。如何在windows应用程序中加载水晶报表

回答

0

如果在应用程序的路径存在于您的报告,然后发现使用

String Path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); 
Path = System.IO.Path.Combine(Path, "example.rpt"); 
rptdoc.Load(Path); 
应用程序的路径
相关问题