问题描述
在asp.net中实现水晶报表的导出,用代码DiskFileDestinationOptionsDiskOpts=newDiskFileDestinationOptions();ReportDoc.ExportOptions.ExportDestinationType=CrystalDecisions.Shared.ExportDestinationType.DiskFile;ReportDoc.ExportOptions.ExportFormatType=ExportFormatType.RichText;DiskOpts.DiskFileName="d:\demo.rtf";可以实现,现在碰到一个问题,我导出的报表有子报表,就是主报表上有个链接,点下后跳到子报表,导出的时候总是导出只能够导出主报表,我在子报表上导出还是导出主报表.
解决方案
解决方案二:
遍历session,查到子报表,导出'setthecrSectionsobjecttothecurrentreport'ssectionscrSections=crReportDocument.ReportDefinition.Sections'loopthroughallthesectionstofindallthereportobjectsForEachcrSectionIncrSectionscrReportObjects=crSection.ReportObjects'loopthroughallthereportobjectstofindallthesubreportsForEachcrReportObjectIncrReportObjectsIfcrReportObject.Kind=ReportObjectKind.SubreportObjectThen'youwillneedtotypecastthereportobjecttoasubreport'objectonceyoufinditcrSubreportObject=CType(crReportObject,SubreportObject)'openthesubreportobjectcrSubreportDocument=crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)DiskFileDestinationOptionsDiskOpts=newDiskFileDestinationOptions();ReportDoc.ExportOptions.ExportDestinationType=CrystalDecisions.Shared.ExportDestinationType.DiskFile;ReportDoc.ExportOptions.ExportFormatType=ExportFormatType.RichText;DiskOpts.DiskFileName="d:\demo.rtf";EndIfNextNext
解决方案三:
还是不能导出报错说:"异常详细信息:System.NotSupportedException:子报表中不支持"走到ReportDoc.ExportOptions.ExportDestinationType=CrystalDecisions.Shared.ExportDestinationType.DiskFile;这段代码