你可以通过代码在Form_Load事件中设定SSRS文件的位置。
参见SSRSDocumentSource快速入门学习如何使用设计器设定文件的位置。
代码
C# |
c1SSRSDocumentSource1.DocumentLocation = new |
VB |
c1SSRSDocumentSource1.DocumentLocation = New |
4.1、显示文件的状态和页数
该章节描述如何使用C1SsrsDocumentSource组件的PageCount 和 State属性来显示文件源的状态以及已经产生的页数。如快速入门所示的创建一个应用程序然后完成下面几个步骤。
在设计器中
- 在窗体中放置两个label。
- 设定第一个label的Name属性为tbReport。
- 设定第二个label的Name属性为tbState。
- 设定第一个label的Text属性为Report:None。这个标签将显示报表的位置。
- 设定第二个label的Text属性为State:Unknown。这个标签将显示报表的状态和产生的页的页数。
在代码中在Form_Load的事件中添加下面的代码,这样就可以将报表的位置,状态和页数显示在标签上。
C# |
SSRSReportLocation rl = c1SSRSDocumentSource1.DocumentLocation as SSRSReportLocation; if (rl != null) tbReport.Text = C1.Win.C1Ssrs.ReportSession.Combine(rl.ReportServer, rl.ReportPath); else tbReport.Text = "None"; switch (c1SSRSDocumentSource1.State) |
VB |
Dim rl As SSRSReportLocation = TryCast(c1SSRSDocumentSource1.DocumentLocation, |
tbState.Text = String.Format("{0}, Pages: {1}", c1SSRSDocumentSource1.State, c1SSRSDocumentSource1.PageCount) |
你完成了什么当运行你的项目时,注意你放置在窗体上的标签显示了报表的位置,状态和已经生成的页面的页数。