KnownTypeSet.Add

KnownTypeSet Add method. Adds the specified Type object to the set.

KnownTypeSet.Add method

Adds the specified Type object to the set.

public void Add(Type type)
ParameterTypeDescription
typeTypeA Type object to add.

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