下面代码,是AR13的,加在form.Designer.cs,没有问题,升级到AR14,不是原项目升级,重新测试了一个form,按钮不显示。提示pdfSetting.OptimizeStatic = true;这个有问题,不知道怎么处理。项目着急,求助!
public void tsbPDF_Click(object sender, EventArgs e)
{
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("标签"));
// Overwrite output file if it already exists
outputProvider.OverwriteOutputFile = true;
pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
MessageBox.Show("PDF文件导出成功!文件位置:D:\\MyPDF\\标签.PDF");
}
|