logo
small logo
  • Products
  • Buy
  • Support
  • Articles
  • Customer panel Support
    • en
    • pt
    • es
    • de
    • pl
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • Plugin for importing data from .XLSX to FastReport .NET
  • Want to generate tables for a user - Excel or OpenOffice Calc?

    October 8, 2020

    Tables. For centuries, they have been used to present similar data for record-keeping, counting amounts,

    read more
  • How to make wedding invitations from Excel

    August 25, 2017

    Do you have a celebration on the occasion of the wedding? Do you need to

    read more
  • How to use SQL queries when creating an internal report data source in FastReport .NET report designer

    September 2, 2019

    When creating a SQL database connection, you can specify a query to select filtered or

    read more
  • How to use Plugin Manager

    September 3, 2019

    FastReport .NET provides a plugin mechanism for extending the functionality of the report designer. Most

    read more
  • Improved interface of the report tree in the FastReport designer

    September 5, 2021

    We have improved report and data trees in the FastReport .NET and Mono designer at

    read more

Plugin for importing data from .XLSX to FastReport .NET

March 16, 2022

FastReport .NET

With the release of FastReport .NET 2022.2, we added a plug-in to connect .XLSX files as a data source.

To use it, you must first build the project:

С:\Program Files (x86)\FastReports\FastReport.Net\Extras\Core\FastReport.Data\FastReport.Data.Excel

After building the project, you will need to add the plugin to the application in one of two ways.

1. Connecting the plugin through the designer:

Connecting the plugin through the designer

2. Add the plugin as a dependency when starting the project and register it in the code with the following command:

FastReport.Utils.RegisteredObjects.AddConnection(typeof(ExcelDataConnection));

To create a connection to Excel, you need to click on the "Data" tab in the designer, and select the "Add Data Source" item. In the window that appears, click on the "New Connection" button. To connect, you need the path to the .XLSX file. If there are no problems with accessing the file, then a list of tables will appear after clicking the "Next" button. When connecting a table, you must check the box to the left of the table name. After that, you can complete the connection.

Connection to Excel

Upon completion of the data source connection, you need to connect a band to it.

Report template using Excel connection

The final report will use the data from the created connection to Excel.

Prepared report with data from an Excel connection

An example of connecting to Excel from code:

// Create ExcelDataConnection instance
var connection = new ExcelDataConnection();
// Set connection string 
connection.ConnectionString = @"C:\Matrix With Rows Only.xlsx";
// Initialize all table
connection.CreateAllTables();
// Set name connection 
connection.Name = "NewConnection";
// Create Report instance
var report = new Report();
// Add connection to report
report.Dictionary.Connections.Add(connection);
// Set connection show
connection.Enabled = true;
// Choose all tables and connect it to the report
foreach (TableDataSource table in connection.Tables)
{
 table.Enabled = true;
}

Because of executing this code, we can see a new connection with tables in the designer. This will be shown in the list of available connections.

Data source added as a result of code execution

It is worth noting that the names of the "sheets" are used as the table name, and the names of the columns are used as the field names.

As you can see, it is now possible to create a connection to Excel and use the data stored there.

about product download buy
avatar
Vladislav Yarovoy
.NET Development
Fast Reports Team: Vladislav Yarovoy - NET Development at Fast Reports
.NET FastReport Excel Designer Plugin XLSX

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • Ticket system
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Contact us

© 1998-2022 by Fast Reports Inc.

  • Privacy Policy