🧠 Introduction
In many enterprise-grade web applications, especially those migrating from legacy systems, ActiveX reports are still used for generating and displaying detailed business reports (like invoices, financial summaries, and logs).
While ActiveX controls are traditionally used with Internet Explorer, you can still embed, generate, and dynamically bind ActiveX reports from a database in modern Angular applications using alternative integration techniques, such as:
Using a COM-based backend API (C#/.NET) to render and serve reports
Embedding report viewers (like Crystal Reports, Stimulsoft, or ActiveReports) via iframe or custom web components
Fetching data dynamically via Angular services (HttpClient)
This article explains how to generate and display dynamic ActiveX-based reports from a SQL database in an Angular frontend.
⚙️ Prerequisites
Before you start, ensure you have the following setup:
Angular 17+
.NET 6+ or .NET Framework 4.8 (for backend ActiveX/COM integration)
SQL Server Database
ActiveX or reporting tool (e.g., ActiveReports, Crystal Reports, or COM Report Engine)
Node.js and npm installed
🧩 Architecture Overview
The flow for generating the dynamic ActiveX report is as follows:
[Angular App] ---> [Web API / .NET Backend] ---> [Database (SQL Server)]
---> [ActiveX Report Engine]
Angular app sends a request (with parameters) to the backend.
Backend retrieves data from SQL Server.
Backend generates a report (ActiveX / COM report file).
Angular displays the generated report (via iframe or viewer component).
🧱 Step 1. Create a Backend API to Generate Reports
You can use a C# .NET Web API to handle the ActiveX or report engine integration.
Here’s a simple example of a backend controller (ReportController.cs):
[ApiController]
[Route("api/[controller]")]
public class ReportController : ControllerBase
{
private readonly IConfiguration _config;
public ReportController(IConfiguration config)
{
_config = config;
}
[HttpGet("GenerateReport")]
public IActionResult GenerateReport(int reportId)
{
string connectionString = _config.GetConnectionString("DefaultConnection");
// Fetch data from SQL Server
var data = new DataTable();
using (SqlConnection con = new SqlConnection(connectionString))
{
string query = "SELECT * FROM Sales WHERE ReportId = @ReportId";
using (SqlCommand cmd = new SqlCommand(query, con))
{
cmd.Parameters.AddWithValue("@ReportId", reportId);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(data);
}
}
// Use COM-based ActiveX Report Engine (e.g., ActiveReports)
var report = new ActiveXReportLib.ReportClass();
report.LoadTemplate("C:\\Reports\\SalesReport.rpt");
report.SetDataSource(data);
string pdfPath = $"C:\\Reports\\Output\\Report_{reportId}.pdf";
report.ExportToPDF(pdfPath);
return File(System.IO.File.ReadAllBytes(pdfPath), "application/pdf");
}
}

Join the conversation! Your thoughts help the community grow.