Integrating Stimulsoft Ultimate with ASP.NET Core MVC

Stimulsoft Ultimate discussion
Post Reply
Ranivorous
Posts: 1
Joined: Tue Jun 25, 2024 3:28 am

Integrating Stimulsoft Ultimate with ASP.NET Core MVC

Post by Ranivorous »

I hope everyone is doing well! I’m currently working on a project where I need to integrate Stimulsoft Ultimate with an ASP.NET Core MVC application, and I could use some guidance from those of you who have experience with this.
geometry dash
Project Overview:
  • Environment:
- ASP.NET Core MVC 5.0
- Stimulsoft Ultimate 2024
- SQL Server 2019
  • Requirements:
- Generate complex reports with data from multiple sources.
- Export reports in various formats (PDF, Excel, etc.).
- Implement role-based access to different reports.

Current Progress:
  • Setup:
- Successfully installed and configured Stimulsoft Ultimate.
- Integrated the Stimulsoft Viewer in a Razor View.
  • Database Connection:
Established a connection to the SQL Server and retrieved data using Entity Framework.

Challenges:
  • Dynamic Data Sources:
I need to dynamically switch data sources based on user input. What’s the best way to achieve this in Stimulsoft?
  • Custom Report Parameters:
How can I pass custom parameters from my MVC controller to the Stimulsoft report?
  • Role-Based Access:
I’m looking for best practices to implement role-based access to reports. Any advice on securing reports based on user roles?

Code Snippet:

Here’s a snippet of my current setup in the controller:

Code: Select all

public IActionResult GenerateReport()
{
    var report = new StiReport();
    report.Load("Reports/MyReport.mrt");

    // Pass parameters
    report.Dictionary.Variables["UserId"].Value = User.Identity.GetUserId();

    // Render report
    var stream = new MemoryStream();
    report.ExportDocument(StiExportFormat.Pdf, stream);
    stream.Position = 0;

    return File(stream, "application/pdf", "Report.pdf");
}
Questions:

- Is there a more efficient way to pass parameters to the report?
- How can I handle different export formats based on user selection (PDF, Excel, etc.)?
- What are the best practices for managing report templates within the project structure?
I would really appreciate any advice, examples, or resources you could provide. Thanks in advance for your help!
Last edited by Ranivorous on Wed Jun 26, 2024 7:31 am, edited 1 time in total.
Lech Kulikowski
Posts: 7333
Joined: Tue Mar 20, 2018 5:34 am

Re: Integrating Stimulsoft Ultimate with ASP.NET Core MVC

Post by Lech Kulikowski »

Hello,

Please check:
- Is there a more efficient way to pass parameters to the report?
https://www.stimulsoft.com/en/documenta ... meters.htm

- How can I handle different export formats based on user selection (PDF, Excel, etc.)?
https://www.stimulsoft.com/en/documenta ... _print.htm

- What are the best practices for managing report templates within the project structure?

You can save/load reports as you need - from strings, objects, files, databases:
https://www.stimulsoft.com/en/documenta ... report.htm

and samples:
https://github.com/stimulsoft/Samples-R ... T-Core-MVC

Thank you.
Post Reply