- C# code
ReportDocument reportDocument = new ReportDocument(); reportDocument.Load(@"C:\RptContainer.rpt"); ISCDReportClientDocument reportClientDocument = reportDocument.ReportClientDocument;
代码只有三行,最后一行的reportDocument.ReportClientDocument异常,
详细信息如下:
“仅当使用 Report Application Server 打开报表时,才能访问 ReportClientDocument 属性”
不知为何,请大牛指教!
------解决方案--------------------------------------------------------
版主帮忙吧 呵呵
------解决方案--------------------------------------------------------
<uc1:WSViewer ID="ReportViewer1" runat="server" ShowPrintButton="true" Width="100%" Height="100%" ProcessingMode ="Local" >
ProcessingMode ="Local"你查查这个属性呢
------解决方案--------------------------------------------------------
使用C#实现的版本
- C# code
using System;
using System.Windows.Forms;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
namespace CS_APP_AddSubReportRuntime
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ReportDocument boReportDocument =new ReportDocument();
ISCDReportClientDocument boReportClientDocument ;
CrystalDecisions.ReportAppServer.Controllers.SubreportClientDocument boSubreportClientDocument;
CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection ;
String strSubRptFile ="";
//加载主报表
boReportDocument.Load(@"E:\CRQuestions\CS_APP_AddSubReportRuntime\Crystalreport1.rpt");
/*----------------------------------------
如果要进行数据、参数、公式操作,请在此处对主报表boReportDocument进行操作
----------------------------------------*/
boReportClientDocument = new ReportClientDocumentClass();
//由主报表返回待RAS操作的ReportClientDocument
boReportClientDocument = boReportDocument.ReportClientDocument;
//获取到第一个section,用来放置子报表
boSection = boReportClientDocument.ReportDefController.ReportDefinition.PageHeaderArea.Sections[0];
//待加载的子报表
strSubRptFile = @"E:\CRQuestions\CS_APP_AddSubReportRuntime\sub1.rpt";
//导入子报表,ss1是子报表对象在主报表上的名称
boSubreportClientDocument = boReportClientDocument.SubreportController.ImportSubreport("ss1", strSubRptFile, boSection);
/*----------------------------------------
如果要进行数据、参数、公式操作,请在此处对子报表boSubreportClientDocument 进行操作
----------------------------------------*/
//刷新Viewer
crystalReportViewer1.ReportSource = boReportDocument;
}
}
}
如果你这个代码仍运行不过的话,非常可能是你的 BO 没有RAS授权。