
fastreport怎么实现网口打印
fastreport直接打印的方法如下
FastReportVCL
在FastReport VCL中,需要将打印选项的对话框设置为False,也可以用以下代码实现。
Report.LoadFromFile('filename');
Report.PrepareReport;
Report.PrintOptions.ShowDialog := False;
Report.Print;
FastReport .NET(WinForm)
使用FastReport.Net在WinForm平台上进行报表开发,实现直接打印的方式和VCL相识,将PrintSettings对话框设置为False就行了,也可以使用以下代码实现。
Report report = new Report();
report.Load(...);
report.RegisterData(...);
report.PrintSettings.ShowDialog = false;
report.Print();
FastReport .NET(WebForm)
使用FastReport ASP.Net版本开发的Web报表时,是不能直接实现直接打印报表,需要先导出为PDF后,再由Adobe Reader的打印功能间接实现。可以参考以下代码。
Report.LoadFromFile('filename');
Report.PrepareReport;
Report.PrintOptions.ShowDialog := False;
Report.Print;
FastReport .NET(WinForm)
使用FastReport.Net在WinForm平台上进行报表开发,实现直接打印的方式和VCL相识,将PrintSettings对话框设置为False就行了,也可以使用以下代码实现。
Report report = new Report();
report.Load(...);
report.RegisterData(...);
report.PrintSettings.ShowDialog = false;
report.Print();
FastReport .NET(WebForm)
使用FastReport ASP.Net版本开发的Web报表时,是不能直接实现直接打印报表,需要先导出为PDF后,再由Adobe Reader的打印功能间接实现。可以参考以下代码。
protected void Button1_Click(object sender, EventArgs e)
{
FastReport.Utils.Config.WebMode = true;
using (Report report = new Report())
{
report.Load("your_report.frx");
report.RegisterData(...);
report.Prepare();
// Export report to PDF stream
FastReport.Export.Pdf.PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
using (MemoryStream strm = new MemoryStream())
{
report.Export(pdfExport, strm);
// Stream the PDF back to the client as an attachment
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "Application/PDF";
Response.AddHeader("Content-Disposition", "attachment;filename=report.pdf");
strm.Position = 0;
strm.WriteTo(Response.OutputStream);
Response.End();
}
}
}
比较麻烦,或者你可以试试FineReport,支持Flash打印,又快又方便,这里附上一张比较图。

2023-06-12 广告