CsvDataLoadOptions

CsvDataLoadOptions class

Represents options for parsing CSV data.

To learn more, visit the LINQ Reporting Engine documentation article.

public class CsvDataLoadOptions

Constructors

NameDescription
CsvDataLoadOptions()Initializes a new instance of this class with default options.
CsvDataLoadOptions(bool)Initializes a new instance of this class with specifying whether CSV data contains column names at the first line.

Properties

NameDescription
CommentChar { get; set; }Gets or sets the character that is used to comment lines of CSV data.
Delimiter { get; set; }Gets or sets the character to be used as a column delimiter.
HasHeaders { get; set; }Gets or sets a value indicating whether the first record of CSV data contains column names.
QuoteChar { get; set; }Gets or sets the character that is used to quote field values.

Remarks

An instance of this class can be passed into constructors of CsvDataSource.

Examples

Shows how to use CSV as a data source (string).

Document doc = new Document(MyDir + "Reporting engine template - CSV data destination.docx");

CsvDataLoadOptions loadOptions = new CsvDataLoadOptions(true);
loadOptions.Delimiter = ';';
loadOptions.CommentChar = '$';
loadOptions.HasHeaders = true;
loadOptions.QuoteChar = '"';

CsvDataSource dataSource = new CsvDataSource(MyDir + "List of people.csv", loadOptions);
BuildReport(doc, dataSource, "persons");

doc.Save(ArtifactsDir + "ReportingEngine.CsvDataString.docx");

See Also