当前位置:编程学习 > C#/ASP.NET >>

子报表不能导出

在asp.net中实现水晶报表的导出,用代码
DiskFileDestinationOptions   DiskOpts   =   new     DiskFileDestinationOptions(); 
ReportDoc.ExportOptions.ExportDestinationType   =   CrystalDecisions.Shared.ExportDestinationType.DiskFile; 
ReportDoc.ExportOptions.ExportFormatType   =     ExportFormatType.RichText; 
DiskOpts.DiskFileName   =   "d:\\demo.rtf "; 
可以实现,
现在碰到一个问题,我导出的报表有子报表,就是主报表上有个链接,点下后跳到子报表,
导出的时候总是导出只能够导出主报表,我在子报表上导出还是导出主报表.
--------------------编程问答-------------------- 遍历session ,查到子报表,导出
  'set the crSections object to the current report's sections
        crSections = crReportDocument.ReportDefinition.Sections

        'loop through all the sections to find all the report objects
        For Each crSection In crSections
            crReportObjects = crSection.ReportObjects
            'loop through all the report objects to find all the subreports
            For Each crReportObject In crReportObjects
                If crReportObject.Kind = ReportObjectKind.SubreportObject Then
                    'you will need to typecast the reportobject to a subreport 
                    'object once you find it
                    crSubreportObject = CType(crReportObject, SubreportObject)

                    'open the subreport object
                    crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)

                    DiskFileDestinationOptions  DiskOpts  =  new    DiskFileDestinationOptions();
ReportDoc.ExportOptions.ExportDestinationType  =  CrystalDecisions.Shared.ExportDestinationType.DiskFile;
ReportDoc.ExportOptions.ExportFormatType  =    ExportFormatType.RichText;
DiskOpts.DiskFileName  =  "d:\\demo.rtf "; 

                End If
            Next
        Next --------------------编程问答-------------------- 还是不能导出报错说:"异常详细信息: System.NotSupportedException: 子报表中不支持"
走到ReportDoc.ExportOptions.ExportDestinationType  =  CrystalDecisions.Shared.ExportDestinationType.DiskFile; 这段代码
补充:.NET技术 ,  图表区
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,