ReportBuilderContext.DataSources
ReportBuilderContext DataSources property. Data sources used to build the report.
ReportBuilderContext.DataSources property
Data sources used to build the report.
public Dictionary<object, string> DataSources { get; }
Remarks
The key represents the data source, while the value is the data source name. The data source name can be null or an empty string; in such cases, the reporting engine will automatically detect the data source name from the specified data source.
Examples
Shows how to specify exact date time parse format in JSON load options.
string templateString = "**Date:** <<[date]:\"dd MMMM yyyy\">>";
string jsonString = "{ date : \"08/24/2025\" }";
JsonDataLoadOptions jsonLoadOptions = new JsonDataLoadOptions();
jsonLoadOptions.ExactDateTimeParseFormats = new List<string> { "MM/dd/yyyy" };
JsonDataSource ds = new JsonDataSource(new MemoryStream(Encoding.UTF8.GetBytes(jsonString)), jsonLoadOptions);
ReportBuilderContext context = new ReportBuilderContext();
context.DataSources.Add(ds, "");
ReportBuilder.Create(context)
.From(new MemoryStream(Encoding.UTF8.GetBytes(templateString)), new LoadOptions() { LoadFormat = LoadFormat.Markdown })
.To(ArtifactsDir + "JsonDataLoadOptions.ExactDateTimeParseFormats.docx")
.Execute();
See Also
- class ReportBuilderContext
- namespace Wordize.Reporting
- assembly Wordize