ReportBuilderOptions.KnownTypes

ReportBuilderOptions KnownTypes property. Gets an unordered set i.e. a collection of unique items containing Type objects which fully or partially qualified names can be used within report templates processed by this engine instance to invoke the corresponding types static members perform type casts etc.

ReportBuilderOptions.KnownTypes property

Gets an unordered set (i.e. a collection of unique items) containing Type objects which fully or partially qualified names can be used within report templates processed by this engine instance to invoke the corresponding types’ static members, perform type casts, etc.

public KnownTypeSet KnownTypes { get; }

Examples

Shows how to specify external types that can be referenced in the template.

string templateString = "Pi=<<[Math.Round(pi, 2)]>>";

ReportBuilderContext context = new ReportBuilderContext();
context.DataSources.Add(System.Math.PI, "pi");
context.ReportBuilderOptions.KnownTypes.Add(typeof(System.Math));

ReportBuilder.Create(context)
    .From(new MemoryStream(Encoding.UTF8.GetBytes(templateString)))
    .To(ArtifactsDir + "ReportBuilderOptions.KnownTypes.docx")
    .Execute();

See Also