Winform中使用FastReport实现自定义PDF打印预览

阅读 85

2023-02-15


场景

Winform中使用FastReport实现简单的自定义PDF导出:

在上面已经实现自定义PDF并导出的基础上,实现导出或者打印前的预览。

实现

在窗体中拖拽一个FastReport的PreviewControl控件,以及Buton按钮。

Winform中使用FastReport实现自定义PDF打印预览_Click

 

然后在Button按钮的点击事件中

private void button2_Click(object sender, EventArgs e)
{
this.report1 = new FastReport.Report();
string baseDir = System.Windows.Forms.Application.StartupPath;
var reportFile = Path.Combine(baseDir, "1.frx");
this.report1.Load(reportFile);
this.report1.Preview = this.previewControl1;
report1.Prepare();
report1.ShowPrepared();
}

运行效果

Winform中使用FastReport实现自定义PDF打印预览_程序猿_02

 

注:

精彩评论(0)

0 0 举报