Scripting inside report
See original GitHub issueHello,
I am running netcore 3 in Mac OSX
I made a simple report using Designer Community following documentation. The Script C# looks like this inside the .frx file:
<ScriptText>using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;
namespace FastReport
{
public class ReportScript
{
private void EstadoResultado_BeforePrint(object sender, EventArgs e)
{
if (((Int16)Report.GetColumnValue("demo")) > 0) {
Demo.TextColor = Color.Red;
}
}
}
}
</ScriptText>
The report works fine in Preview from Designer Community.
I developed a simple Web API project using netcore 3.1 following one of your samples. The API use PDFSimpleExport to generate a PDF from report:
report.Prepare();
PDFSimpleExport pdf = new PDFSimpleExport();
MemoryStream memStream = new MemoryStream();
report.Export(pdf, memStream);
This code works perfectly with a report with no Scripting. But if I try with the before scripted report I have:
An unhandled exception has occurred while executing the request.
FastReport.Utils.CompilerException: (21,24): Error CS0012: The type 'Color' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing.Primitives, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
(21,36): Error CS0103: The name 'Color' does not exist in the current context
at FastReport.Code.AssemblyDescriptor.InternalCompile()
at FastReport.Code.AssemblyDescriptor.Compile()
at FastReport.Report.Compile()
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
How can we add the reference to that assembly? How can we add the needed assembly referenced in the Report Script? Everything inside the Script is pure NetCore, I mean will run in any paltform?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Add scripting to conditions of report
Solved: Hi, I'm trying to add scripting to a report that I am creating, but I'm having some trouble and can't figure out...
Read more >How to call Script Include function in Reports |ServiceNow
We will be seeing how can we display all incidents raised by a particular group members in a Report.
Read more >Scripting in Section Reports | ActiveReports 15 .NET Edition
In a section report, ActiveReports allows you to use VB.NET or C# script to port your custom logic to report layouts. This permits...
Read more >Understanding Report Script Basics
A report script comprises a series of Report Writer commands, terminated by the bang (!) report output command. You can enter one or...
Read more >Scripts Overview | Reporting
ScriptLanguage property to specify the language to write scripts in the report. Report Designers support the following script languages: C#; Visual Basic .NET ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
sorry used nuget and got opensource and compat Using winForms .net framework 4.6.1 and vs2022 … trying to replace winforms reporting so I can upgrade it. 2021.3.1 appears to work for me.
@drechema In the last update we made the automatic addition of assembly if they are known to .Net. In case of unknown assemblies, please add (do not replace) them in Report.ReferencedAssemblies before preparing the report (before Report.Prepare()).