ActiveReports 16 .NET Edition
ActiveReports 16 User Guide / Concepts / Section Report Concepts / Data Binding / Connect to a Data Source / CSV Provider
In This Topic
    CSV Provider
    In This Topic

    This article explains connecting a section report to a CSV data source.

    Connect to a CSV Data Source

    1. In the designer, select the Data Source icon on the Detail section of the report or click the gray area around the design surface and select the Edit Data Source link in the Properties pane.
    2. In the Report Data Source dialog that appears, select the CSV tab to connect to a CSV data source.
    3. Click the Build button next to the Connection String section to open the Configure CSV Data Source dialog box.
      Configure CSV Data Source Wizard
    4. To specify the Path of the file, click the Open button and navigate to the desired folder on your system. For example, you can connect to the MyOrders.csv sample datasource from GitHub.
    5. Select the Column Separator as Comma from the drop-down menu. 
    6. Click the Get from Preview button to fill the Columns area with the column names (or fields) and their corresponding data types (string by default). 
      For more information, see the Configuration Properties for CSV Data Source section.
    7. Click the OK button to save the changes and close the Configure CSV Data Source dialog. 
      Configure CSV Data Source Wizard

      The Connection String section displays the generated connection string as shown below:    
      Connection String
      Copy Code
      Path=C:\\MyOrders.csv;Locale=en-IN;TextQualifier=";ColumnsSeparator=,;RowsSeparator=\r\n;Columns=ID,Product,Customer,OrderNumber,Stock,Total(Decimal),UnitPrice(Decimal),City,ProductLine,Discount(Decimal);HasHeaders=True
      
    8.  Click the OK button to close the Report Data Source dialog. Your report is now connected to the CSV data source successfully.

    Configuration Settings for CSV Data Source

    The CSV Data Provider provides the following configuration settings in the Configure CSV Data Source dialog. Based on the defined configuration settings, the CSV connection string is generated. 

    Setting Description Example
    Path Path to the CSV file - both local and relative; or a URL for centrally located CSV data sources. C:\MyOrders.csv
    Encoding Specify the character encoding used in the CSV file. Unicode (UTF-8)
    Locale Specify the locale used in the CSV file. English (United States)
    File Type

    Define the type of CSV file. You can choose from Fixed and Delimited options.

    Delimited
    Starting Row Row number to start fetching data. 0
    Text Qualifiers Character to specify where the text begins and ends, that is, the character that encloses values in the CSV file. You can choose from Quotes and Single quotes options. Quotes
    Columns have headers Specify whether the CSV file has columns with headers or not. Checked
    Column Separator Specify the symbol used to separate the columns in the CSV file. You can choose from Comma, Semicolon, Tab, and Space options. Comma
    Row Separator Symbol used to separate the rows in the CSV file. You can choose from CRLF (carriage return and line feed), CR (carriage return), and LF (line feed) new line formats. New line (CRLF)
    Treat consecutive as one Specify whether to join the column separators or row separators as one. Checked for Column separator

    Unchecked for Row Separator
    Get from preview

    Fills the Columns area with names and data types (string by default) for columns present in the CSV file. You can customize the column names and specify the data type for each column. The data types supported are:

    • String - Stores alphanumeric characters
    • Boolean - Stores true or false values
    • DateTime - Stores both date and time values
    • Integer - Stores integer values ranging from -2,147,483,648 to 2,147,483,647
    • Float - Stores decimal numbers with single precision
    • Decimal - Stores exact numeric value with fixed precision and scale
    • Double - Stores decimal numbers with double precision
    • Long - Stores integer values ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
    UnitPrice(Decimal)
    Note: Text QualifiersColumn Separator, Row Separator, and Treat Consecutive as one options are not available for Fixed file type.