Table of Contents

Getting Started

Welcome to Report.NET, the comprehensive reporting library for .NET applications. This guide will help you get started with integrating Report.NET into your projects. By following these steps, you'll be able to create, customize, and export reports in your .NET applications.

Prerequisites

Before you begin, make sure you have the following:

  • .NET SDK installed on your system. Report.NET is compatible with the Microsoft .NET Framework.
  • A preferred IDE, such as Visual Studio or Visual Studio Code, for development.

Installation

Report.NET can be added to your project via NuGet Package Manager. This is the most straightforward method to include the library in your project.

Using Visual Studio

  1. Open your solution in Visual Studio.
  2. Right-click on your project in the Solution Explorer and choose Manage NuGet Packages.
  3. Go to the Browse tab and search for Report.NET.
  4. Select the package and click Install.

Using .NET CLI

Alternatively, you can use the .NET CLI to add the Report.NET package to your project. Open a terminal or command prompt, navigate to your project directory, and run the following command:

dotnet add package Report.NET

Basic Usage

Here is a simple example of generating a PDF file:

Creating Your First Report

Once Report.NET is added to your project, you can start creating reports. Here’s how to generate a simple report.

Step 1: Setting Up a Report

First, you need to derive a class from the PdfReport class and override method Create. Create file HelloWorldReport.cs.

using Root.ReportNet.Pdf;

public class HelloWorldReport : PdfReport {
  protected override void Create() {
    ...
  }
}

Step 2: Adding Content

Next, add some content to your report. This could be text, images, tables, etc.

using Root.ReportNet.Pdf;

public class HelloWorldReport : PdfReport {
  protected override void Create() {
    StandardFontDef fd = new(StandardFont.Helvetica);
    FontProp fp = new(fd, 50);

    Page page = new();
    page.AddCenteredMM(200, new RepString(fp, "Hello World!"));
    AddPage(page);
  }
}

Step 3: Rendering the Report

Finally, you need to render your report. In this example, we'll export it to a PDF file. Create file Program.cs

public class Program {
  static void Main() {
    HelloWorldReport report = new();
    report.Save();
  }
}

Conclusion

You've now seen how to get started with Report.NET, from installation to creating a simple report. This guide only scratches the surface of what's possible with Report.NET. As you become more familiar with the library, you'll discover its extensive capabilities for creating sophisticated reports.

For more advanced features, please refer to the official documentation and examples.

Happy reporting with Report.NET!