如何使用活动报告生成PDF

问题描述 投票:0回答:1

我正在使用Active Report生成PDF模板。

下面是我编写的代码,但是当我运行代码时却生成了PDF,但没有打开它,表明可能未正确创建PDF

    public partial class CheckListReport : GrapeCity.ActiveReports.SectionReport
    {
        string fileNameNew = @"D:\Omkar1\ActiveReportCheckList.pdf";
        public void ReportsDate()
        {
            using (FileStream fs = new FileStream(fileNameNew, FileMode.Create))
            {
                string date = DateTime.Today.ToString();
                string versionNo = "1.0.77";

                richTextBox1.SelectionFont = new Font("Arial", 10, FontStyle.Regular);
                richTextBox1.SelectionColor = Color.Blue;
                richTextBox1.ReplaceField("Report Generated On", date);
                richTextBox1.ReplaceField("Version Number", versionNo);
            }
        }
    }

还有其他生成PDF的方法,因为我想查看模板格式

c# pdf activereports
1个回答
0
投票
导出过滤器。请参考下面的示例代码和PDF导出过滤器示例:

// Export the report in PDF format. GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport(); PdfExport1.Export(MyDocument, Application.StartupPath + "\\PDFExpt.pdf"); https://www.grapecity.com/activereports/docs/v14/online/pdf-export.html

此外,您可以参考以下使用PDF导出过滤器的另一个示例:https://github.com/activereports/Samples14/tree/master/API/Section/Export

查看我们的文档以获取有关导出的更多信息:https://www.grapecity.com/activereports/docs/v14/online/exporting.html

真诚地,

GrapeCity支持团队

https://www.grapecity.com/support/contact

© www.soinside.com 2019 - 2024. All rights reserved.