AR13.1,VS2017C#
在winform中viewer控件,页面报表,预览数据正常,通过代码增加PDF导出,生成的PDF文件,只有格式,无数据。另能否在导出时可以选文件路径及进度条。谢谢!
代码如下:
public void tsbPDF_Click(object sender, EventArgs e)
{
// Provide the page report you want to render.
System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\装箱单.rdlx");
GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);
// Create an output directory.
System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"D:\MyPDF");
outputDirectory.Create();
// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
// Reduce the report size and report generation time.
pdfSetting.OptimizeStatic = true;
// Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
// Overwrite output file if it already exists
outputProvider.OverwriteOutputFile = true;
pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
}
|
|