请教:
我需要将报表的文件直接以PDF文件导出,参考下面的例子:
GrapeCity.ActiveReports.Samples.EndUserDesigner
bool isFpl = true; //_reportType == DesignerReportType.Page; var pdfRenderingExtension = new PdfRenderingExtension(); //var pdfSettings = pdfRenderingExtension.GetSupportedSettings(isFpl);
StreamProvider StreamProvider = new FileStreamProvider(new DirectoryInfo(Path.GetDirectoryName(sFile)), Path.GetFileNameWithoutExtension(sFile));
if (File.Exists(sFile)) { File.Delete(sFile); }
PageExport pdfExport = new PageExport { DisplayName = GrapeCity.ActiveReports.Samples.EndUserDesigner.Properties.Resources.PagePDFString, DefaultFileName = GrapeCity.ActiveReports.Samples.EndUserDesigner.Properties.Resources.PDFFileName, Settings = pdfRenderingExtension.GetSupportedSettings(isFpl), Filter = GrapeCity.ActiveReports.Samples.EndUserDesigner.Properties.Resources.PDFFilter, RenderingExtension = pdfRenderingExtension, };
viewer1.Render(pdfRenderingExtension, StreamProvider, pdfExport.Settings.GetSettings());
执行到最后一句的时候,会提示:Operation is not supported for section report. 如果已经加载到页面之后,通过一个按钮执行这段代码,则可以实现正常导出。
请教应该如何解决在不显示到界面上的情况下,如何实现导出,多谢。
|