CsvDataLoadOptions.QuoteChar

CsvDataLoadOptions QuoteChar property. Gets or sets the character that is used to quote field values.

CsvDataLoadOptions.QuoteChar property

Gets or sets the character that is used to quote field values.

public char QuoteChar { get; set; }

Remarks

Use quotes when a field value contains the delimiter character. For example, if the delimiter character is ; and the field value is Spy;Operative, the value should be wrapped in quotes to be treated as a single value.

Examples

Shows how to fill template with data from CSV data source loaded from file using LINQ Reporting engine.

CsvDataLoadOptions csvLoadOptions = new CsvDataLoadOptions();
csvLoadOptions.QuoteChar = '\'';
csvLoadOptions.CommentChar = '|';
csvLoadOptions.Delimiter = ',';
csvLoadOptions.HasHeaders = true;
CsvDataSource ds = new CsvDataSource(MyDir + "ReportingData.csv", csvLoadOptions);

ReportBuilderOptions reportBuilderOptions = new ReportBuilderOptions();
reportBuilderOptions.AllowMissingMembers = true;

using (Stream input = File.OpenRead(MyDir + "ReportingTemplateForeach.docx"))
using (Stream output = File.Create(ArtifactsDir + "ReportingForeachCsvDataSource.pdf"))
{
    ReportBuilder.BuildReport(input, output, SaveFormat.Pdf, ds, "data", reportBuilderOptions);
}

See Also