.NET Core 2.x Load and Populate a rdlx Report Template with ActiveReports

Posted by: scott.matthews on 30 October 2019, 9:45 am EST

    • Post Options:
    • Link

    Posted 30 October 2019, 9:45 am EST

    I am looking for a ActiveReports sample in C# of loading and populating an rdlx report created in the report designer in an .NET Core 2.x service. I would like to bind the report to a set of entity classes that contain the data to hydrate the fields in the report. Once the report is hydrated, then save the invoice template out as a PDF. I have been searching but so far have not found a sample of populating a report in this manner. Any guidance would be much appreciated.

  • Posted 30 October 2019, 3:43 pm EST

    Hello Scott,

    Ar13 does not support the .Net Core. AR still need .Net FW for report rendering. Yes, there is a plan to support .Net Core in our next major release i.e AR14.

    As of now, you can use the following way to use the AR in .Net application.

    1:Prepare a reporting service in .Net FW

    2:Create a viewer application in Asp.Net core using JSVIewer(Part of AR)

    3:Use the above report service in the Asp.Net core application to preview the report.

    Could you please if this method will fulfill your requirement, I will create the sample for you?

    Thanks and Regards,

    Mohit Garg

  • Posted 31 October 2019, 12:21 am EST

    Mohit,

    Yes, I can make this work. A sample of loading the rdlx template and populating it with an in memory object would be awesome.

    Thanks,

    Scott

  • Posted 31 October 2019, 2:29 am EST

    Hello Scott,

    Sorry to mention that I don’t understand what you want. Could you please explain in detail. Currently, we can make AR report service in .Net FW which is consumed by JSViewer in .Net core application through URL.

    Thanks,

  • Posted 31 October 2019, 3:10 am EST

    In the service code which will be a .NET FW class library, I would like to pull an Invoice.rdlx template from local storage and populate it with my domain classes that contain the relevant invoice data. Then save the Invoice report as a PDF document. This PDF is either emailed or printed for customers. I will eventually utilize the JSViewer to allow my end users to customize and modify the report templates. But the first objective is to generate Invoices in the billing engine based upon the template. Let me know if this does not give you detail.

  • Posted 31 October 2019, 7:23 am EST

    Correction to my previous statement. I would like to render the PDF into a byte verses saving to local storage.

  • Posted 31 October 2019, 5:11 pm EST

    Hello,

    Please refer to the attached sample as per your requirement. I used the “DataSet Provider” to load the data from the datatable at runtime and PdfRenderingExtension to export the report to PDF.

    Please refer to the following documentation link:

    https://help.grapecity.com/activereports/webhelp/AR13/webframe.html#RenderingtoPDF.html

    https://help.grapecity.com/activereports/webhelp/AR13/webframe.html#BindPageReportstoaDataSource.html

    Hope it helps.

    Thanks,

    Mohit

    Web_PdfExport.zip

  • Posted 4 November 2019, 11:32 am EST

    Mohit,

    Thanks a lot for the reply and sample code. I moved a version of the code into a .NET Framework 4.8 class library. I have attached a code sample. When I hit the line to load the report: var report = new GrapeCity.ActiveReports.PageReport(new FileInfo(@“C:\xfer\Invoice.rdlx”));

    I get the following exception:

    Message = “Method not found: ‘System.String System.AppDomainSetup.get_LicenseFile()’.”

    I have cleaned and rebuilt, closed and re-opened the solution and nothing seems to get past the exception. Have you seen this error before and if so what was the resolution?

  • Posted 4 November 2019, 11:34 am EST - Updated 30 September 2022, 8:25 am EST

  • Posted 4 November 2019, 10:25 pm EST

    Hello Scott,

    There is no issue in code. Have you included the “Licenses.licx” file in your project with the following entry?

    GrapeCity.ActiveReports.PageReport, GrapeCity.ActiveReports

    Request to please confirm are you able to replicate the issue with only 4.8 FW?

    Also, try to license your web application with “WebKeyGenerator”. For more information please refer the topic “To license medium trust projects” in the following link:

    https://help.grapecity.com/activereports/webhelp/AR13/webframe.html#arHOWLicensingActiveReports.html

    Thanks,

    Mohit

  • Posted 5 November 2019, 2:30 am EST

    The issue appears to be with the root project for the call. It is a .NET Core 3.0 web API. When I add the license file to that project it will not build with the following error: MSB6003 The specified task executable “lc.exe” could not be run. System.ComponentModel.Win32Exception (0x80004005): The filename or extension is too long

    I did some digging and added a workaround in the project file that allowed the project to build but still get the error: “Method not found: ‘System.String System.AppDomainSetup.get_LicenseFile()’.” when attempting to load the report.

    I tried adding the web key in the appsettings.json file for the API project generated via the WebKeyGenerator with no success.

    Can you think of anything else that I can try to get it to pickup the license information?

  • Posted 5 November 2019, 11:00 am EST

    This looks to be a know issue. I will have to look for a workaround as it does not appear to be an issue with AR13.

    https://github.com/dotnet/winforms/issues/1462

  • Posted 5 November 2019, 2:57 pm EST

    Hello Scott,

    As I said earlier, AR13 does not work with .Net core. AR13 needs the .Net FW for rendering and AR13 licensing functionality is fully based on .Net FW. We have the major release(AR14) next month(approx mid of Dec) which will support the .Net core and in AR14 new licensing functionality will be added to support .Net core.

    Thanks,

    Mohit

  • Posted 6 November 2019, 1:16 am EST

    Right, I know that AR13 does not work with .NET Core but from what I read your embedded license file has to be included in the root project and not just the project that contains the report logic. The report logic is in a .NET FW 4.8 project with the license file as an embedded resource. I get the error at run-time that the license information can not be found so I tried adding it to the root project. If you can tell me how to get the license information to be picked up in the FW project without adding it in the root .NET Core project that contains the controllers that would solve my blocker. Otherwise, it does not seem that there is a way that I can the report components to pick up the license information without refactoring my API project that contains the controllers in .NET FW 4.8 with AR13.

  • Posted 6 November 2019, 5:12 pm EST

    Hello,

    Could you please share your runtime environment? Is it .Net core or .Net FW? Also, You can try with the “ApplicationLicenseGenerator.exe”. Please refer to the “To license ActiveReports when you cannot compile the calling application or the calling application is COM” topic in the following link:

    https://help.grapecity.com/activereports/webhelp/AR13/webframe.html#arHOWLicensingActiveReports.html

    Also, please share your project structure and flow with us.

    Thanks,

    Mohit

  • Posted 7 November 2019, 3:01 am EST

    You should be able to run the example from swagger after setting the API project as startup. Set a breakpoint on Line 20 of InvoiceGenerator.cs in FireBill.Api.Reporting. This is where I am encountering the error: Method not found: ‘System.String System.AppDomainSetup.get_LicenseFile()’.

    FireBill_Sample.zip

  • Posted 7 November 2019, 6:53 am EST

    Mohit, Do not worry about looking into this any further. Thanks for all of your help.

  • Posted 7 November 2019, 3:23 pm EST

    Hello Scott,

    I tried to run the sample but got the same error as you mentioned. You are running the application in .Net core environment that’s why this issue occurs. Your “FireBill.Api.Reporting” dll created from 4.8 FW but it is used in .Net Core environment. We are getting the license from the domain and .net core does not support the app domains. There is no solution to this. You need to wait for AR14 as we changed the licensed functionality to support .Net core.

    Hope it clarifies.

    We are very sorry for the inconvenience caused to you.

    Thanks,

    Mohit

  • Posted 17 December 2019, 2:54 pm EST

    Hello,

    I am glad to tell you that AR14 is release now which includes the supports of .Net core. For more information , you can refer the following link:

    https://www.grapecity.com/activereports

    https://www.grapecity.com/activereports/docs/v14/online/overview.html

    Also, you can download the trial version of AR14 from the following link:

    https://www.grapecity.com/download/activereports

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels