ActiveReports 12
Reports with CSV Data
ActiveReports 12 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Page Report/RDL Report Walkthroughs > Data > Reports with CSV Data

This walkthrough explains the steps involved in connecting a page report to a CSV data source. The walkthrough is split up into the following activities:

Note:

When you complete this walkthrough you get a layout that looks similar to the following at design time and at run time.

Design-Time Layout

Run-Time Layout

To 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 12 Page Report Application and in the Name field, rename the file as ProductsStock.
  3. Click OK to create a new ActiveReports 12 Page Report Application. By default a Page report is added to the project.

See Adding an ActiveReport to a Project for information on adding different report layouts.

To 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 File Path, click the Open button and navigate to [User Documents folder]\GrapeCity Samples\ActiveReports 12\Data and select the Products_header_tab.csv file.
  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:
    Path=C:\\[User Documents folder]\\GrapeCity Samples\\ActiveReports 12\\Data
    \\Products_header_tab.csv;Locale=en-US;
    TextQualifier=";ColumnsSeparator= ;RowsSeparator=\r\n;HasHeaders=True


    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.

To 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

To view the report

OR

See Also

Reference