Use FastReport report tool to generate report PDF document hospital case

FastReport .Net is a full-featured report solution for Windows Forms, ASP.NET, MVC and .NET Core. It can be used in Microsoft Visual Studio 2005-2019. Support .Net Framework 2.0-4.x, .NET Core 3.0 and above.

In the new version of FastReport .NET 2021.1, we have implemented support for .NET 5. Added a new barcode-Deutsce Post Leitcode. The algorithm for converting RTF into report objects has been significantly improved. And also added new functions for converting numbers. Welcome to download and experience. (Click the button below to download)

Click to download the latest version of FastReport.NET v2021.1 now

Related content recommendation:

Use FastReport report tool to generate report PDF document case (1)

Use FastReport report tool to generate report PDF content case (2)

3. Use other report design-Ruilang report design display

When using the FastReport report option, I also tried the processing method of Ruilang report. The overall presentation effect of Ruilang report is also very good. By the way, I will introduce the design of Ruilang report and binding data source at runtime. Step code for reference.

First of all, we need to define the template information of a report. Just like the FastReport report template, it is also defined in a similar way. The report template design is shown below.

As we can see above, it also has two ways of parameter binding and field binding.

The code to implement data binding is shown below.
//Generate PDF report documents to specific files
GridExportHelper helper = new GridExportHelper(reportPath);
var json = FileUtil.FileToString(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, “Report/Pres.json”), Encoding.UTF8) ;
bool success = helper.ExportPdf(json, realPath, HttpContext);
if (success)
{ result = Content(exportPdfPath);//Return the relative path of the web } helper.Dispose();//Destroy the object where ExportPdf receives a JSON character String, the implementation code is shown below. /// /// Export PDF /// /// List object type /// List object /// Storage path /// /// public bool ExportPdf(string json, string filePath, HttpContextBase context) { //From Load report template data in the corresponding file















Report.LoadFromFile(this.ReportPath);

        //加载JSON对象
        Report.LoadDataFromXML(json);

        IGRExportOption ExportOption = Report.PrepareExport(GRExportType.gretPDF);
        var exportPdf = Report.ExportToBinaryObject();
        Report.UnprepareExport();

        var succeeded = exportPdf.SaveToFile(filePath);
        return succeeded;
    }

The final result is shown below.
Insert picture description here

Guess you like

Origin blog.csdn.net/RoffeyYang/article/details/112614759