This section is specifically for Bold Reports® version less than
3.x
. If you are using a higher version of Bold Reports®, recommend you to embed the VB code directly in the report itself, as VBCodeProvider is now available in the .NET Core platform.
Custom code in a report allows to include new custom constants, variables, functions, or subroutines. As the VBCodeProvider is not available in .NET Core platform, report with custom codes requires additional settings to enable this feature. This section describes the steps required to use custom codes with Report Writer.
namespace BoldReports.Processing.Helper
{
public static class Code
{
public static string PrintHelloWorld()
{
return "Hello World";
}
}
}
If you have created the custom code class, then you need to add the assemblies in the list with what you have used in your application to Report Writer as shown in following code example.
using (var reportWriter = new ReportWriter())
{
reportWriter.Assemblies.Add(this.GetType().GetTypeInfo().Assembly);
reportWriter.LoadReport(inputStream);
}
If you want to use the custom code feature, then you should not use the ReportWriter(Stream ReportStream) constructor to load the report and assemblies added with Assemblies property before using LoadReport method.