ActiveReports 16 .NET Edition
ActiveReports 16 User Guide / Samples and Walkthroughs / Walkthroughs / Page Report/RDL Report Walkthroughs / Data / Reports with CSV Data
In This Topic
    Reports with CSV Data
    In This Topic

    This topic explains the steps involved in connecting a page report to a CSV data source.

    • This topic uses the Products_header_tab.csv sample database. The Products_header_tab.csv file can be downloaded from GitHub: ..\Samples16\Data\ Products_header_tab.csv.
    • Although this topic uses Page reports, you can also implement this using RDL reports.

    When you complete these steps, the layout that looks similar to the following at design time and at run time.

    Design-Time Layout

    Report with CSV Data at Design Time

    Report with CSV Data at Design Time

    Run-Time Layout

    Report with CSV Data at Run Time

    Report with CSV Data at Run Time

    Add an ActiveReport to the Visual Studio project

    1. Create a new Visual Studio project.
    2. In the New Project dialog that appears, select ActiveReports 16 Page Report Application and in the Name field, rename the file as ProductsStock.
    3. Click OK to create a new ActiveReports 16 Page Report Application. By default a Page report is added to the project.

    See Basic Concepts for information on adding different report layouts.

    Connect the report to a CSV data source

    1. In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
    2. In the Report Data Source dialog that appears, select the General page and enter the name of the data source. By default, the data source name is set to DataSource1. This name appears as a child node to the Data Sources node in the Report Explorer.
    3. Under the Type field, select CSV Provider.
    4. In the Connection String tab, click the Build icon to open the Configure CSV Data Source wizard.
    5. To specify the Path of the file, click the Open button and navigate to [User folder]\Samples16\Data\Products_header_tab.csv file, which can be downloaded from GitHub.
    6. Select the Column Separator as Tab from the drop-down menu. See the Sample CSV Connection String in the topic CSV Provider for further details.
    7. Click OK to save the changes and close the Configure CSV Data Source wizard. The Connection String tab displays the generated connection string as shown below:
      Connection String
      Copy Code
      Path=C:\\[User folder]\\Samples16\\Data \\Products_header_tab.csv 

      You can validate the connection string by clicking the Validate DataSource icon.
    8. Click OK to close the Report Data Source dialog. You have successfully connected the report to the CSV data source.
    Note: The dataset for a CSV data source is automatically added. The default name of the data set is name of the CSV file selected.

    Add controls to the report

    1. From the toolbox, drag a Table data region onto the design surface of the report.
    2. Select the last column of the table, right-click, and select Insert Column to the Right option to add a fourth column.
    3. Go to the Properties window and set the properties for the Table data region as described in the following section: 
      Property Name Property Value
      Location 0.375in, 0.5in
      DataSetName Products_header_tab
      Size 5.5in, 0.75in
      FixedSize 5.5in, 2in
    4. From the Report Explorer, drag the fields into the Table Details row as described in the following section:
      Field Name TextBox
      ProductName TextBox4
      QuantityPerUnit TextBox5
      UnitPrice TextBox6
      UnitsInStock TextBox11
    5. Select the Table Header row and set FontWeight to Bold.
    6. From the toolbox, drag a TextBox onto the design surface of the report, go to the Properties window to set the properties as described in the following section:
      Property Name Property Value
      Location 2.5in, 0in
      Size 1.375in, 0.25in
      Value Products Stock
      FontSize 12pt
      FontWeight Bold

    View the report


    See Also