How to use Excel file as data source in FastReport.Net report

First, there are requirements for the Excel file, each table needs to be placed in a separate table, and the first row is the column header used to name the table fields.

 

1. Use a table to create an Excel document

 

 

2. Create a Windows Forms project

 

3. Add a report controller to the form

 

4. Double-click the added controller, skip the data source window, and the report designer will be displayed

 

5. Create a new data source connection in the report designer. Menu Data->Add Data Source

 

 

The Data Source Wizard program displays:

 

 

6. Create a new string concatenation with the same named button

 

 

7. In the string connection creation window, select the connection type as ODBC Connection

 

 

Open the "Use connection string" button and select the data source

 

 

8. Here, select the "Computer data source" tab

 

 

9. Select "Excel Files" and click OK

 

 

Select the .xls or .xlsx file containing the data in the window that opens

 

Close the wizard for string concatenation via the OK button

 

String concatenation looks like this:

Dsn=Excel Files;dbq=C:\Users\Gromozeka\Documents\Visual Studio 2010\Projects\ExcelDataSource\ExcelDataSource\bin\Debug\Employee.xlsx;defaultdir=C:\Users\Gromozeka\Documents\Visual Studio 2010\Projects\ExcelDataSource\ExcelDataSource\bin\Debug;driverid=1046;maxbuffersize=2048;pagetimeout=5

 

10. In the data source wizard, select Next.В мастере создания источника данных нажимаем Next. Jump to the data selection window

 

 

Select the desired form and click Finish

 

11. A new data source is added to the data window

 

12. Now we can create the report template to put all the fields into the data band

 

 

Run the report

To sum up, you can automate your accounting statements using the data in an Excel file. A data source can contain a large number of tables, depending on the number of tables in the spreadsheet. Many companies still hold accounts in excel format, which you can use in your statements.

Click to download the latest version of FastReport.Net>>

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326522264&siteId=291194637