CsvDataSource Class

Wordize.Reporting.CsvDataSource class. Provides access to data of a CSV file or stream to be used within a report.

CsvDataSource class

Provides access to data of a CSV file or stream to be used within a report.

public class CsvDataSource

Constructors

NameDescription
CsvDataSource(Stream)Creates a new data source with data from a CSV stream using default options for parsing CSV data.
CsvDataSource(string)Creates a new data source with data from a CSV file using default options for parsing CSV data.
CsvDataSource(Stream, CsvDataLoadOptions)Creates a new data source with data from a CSV stream using the specified options for parsing CSV data.
CsvDataSource(string, CsvDataLoadOptions)Creates a new data source with data from a CSV file using the specified options for parsing CSV data.

Examples

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

string csvString = "Name,Position\r\nJames Bond,Spy";
CsvDataLoadOptions csvLoadOptions = new CsvDataLoadOptions() { HasHeaders = true };
CsvDataSource ds = new CsvDataSource(new MemoryStream(Encoding.UTF8.GetBytes(csvString)), csvLoadOptions);

ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx", ArtifactsDir + "ReportingForeachCsvDataSource.docx", ds, "data");

See Also