CsvDataSource
CsvDataSource constructor. Creates a new data source with data from a CSV file 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.
public CsvDataSource(string csvPath)
| Parameter | Type | Description |
|---|---|---|
| csvPath | String | The path to the CSV file to be used as the data source. |
See Also
- class CsvDataSource
- namespace Wordize.Reporting
- assembly Wordize
CsvDataSource(string, CsvDataLoadOptions)
Creates a new data source with data from a CSV file using the specified options for parsing CSV data.
public CsvDataSource(string csvPath, CsvDataLoadOptions options)
| Parameter | Type | Description |
|---|---|---|
| csvPath | String | The path to the CSV file to be used as the data source. |
| options | CsvDataLoadOptions | Options for parsing the CSV data. |
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
- class CsvDataLoadOptions
- class CsvDataSource
- namespace Wordize.Reporting
- assembly Wordize
CsvDataSource(Stream)
Creates a new data source with data from a CSV stream using default options for parsing CSV data.
public CsvDataSource(Stream csvStream)
| Parameter | Type | Description |
|---|---|---|
| csvStream | Stream | The stream of CSV data to be used as the data source. |
See Also
- class CsvDataSource
- namespace Wordize.Reporting
- assembly Wordize
CsvDataSource(Stream, CsvDataLoadOptions)
Creates a new data source with data from a CSV stream using the specified options for parsing CSV data.
public CsvDataSource(Stream csvStream, CsvDataLoadOptions options)
| Parameter | Type | Description |
|---|---|---|
| csvStream | Stream | The stream of CSV data to be used as the data source. |
| options | CsvDataLoadOptions | Options for parsing the 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
- class CsvDataLoadOptions
- class CsvDataSource
- namespace Wordize.Reporting
- assembly Wordize