ActiveReports 11
Script Property
Example 

GrapeCity.ActiveReports.v11 Assembly > GrapeCity.ActiveReports Namespace > SectionReport Class : Script Property
Sets or returns the script code for a report's events.  Either this property or the script editor may be used to add script to a report.
Syntax
'Declaration
 
Public Property Script As String
public string Script {get; set;}

Property Value

The current script code. The default value is an empty string.
Remarks

The Script property can be used to make modifications to the report outside the code written in the report's events. The script events run immediately after their matching ActiveReports code-behind events and take precedence over the code inside the project.

If reports with scripts are saved to XML, the scripts (unlike code-behind) are incorporated into the XML file. Changes can be made to the XML file scripts and then loaded back into a report project to show the changes. This allows reports to be modified without requiring the project to be recompiled.

When referencing the report in the script, use rpt instead of the report's name or "Me" or "this".

In order to reference a member of the report class using the "rpt" named object, the member has to be a public member. You can use a control's modifier property to change the generated code for a control from private to public.

If you plan to run the report from a stand-alone RPX file without the compiled code-behind class, your scripting code would have to reference the report class controls using the Controls collection instead of by name.

Scripts are compiled at run time using the language specified in the ScriptLanguage property.

Example
This snippet assumes that you have html in the RichTextBox, and that the Modifiers property of the RichTextBox is set to Public.
private void button1_Click(object sender, System.EventArgs e)
{
    string sScript = string.Empty;
    SectionReport1 rpt = new SectionReport1();

    sScript += "public void ReportHeader_Format()";
    sScript += "{";
    sScript += "rpt.RichTextBox1.Html = rpt.RichTextBox1.Text;";
    sScript += "}";

    rpt.Script = sScript;
    rpt.Run();
    arv.Document = rpt.Document;
}
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScript.Click
    Dim sScript As String = String.Empty
    Dim rpt As New SectionReport1

    sScript += "public void ReportHeader_Format()"
    sScript += "{"
    sScript += "rpt.RichTextBox1.Html = rpt.RichTextBox1.Text;"
    sScript += "}"

    rpt.Script = sScript
    rpt.Run()
    Viewer1.Document = rpt.Document
End Sub
See Also

Reference

SectionReport Class
SectionReport Members
ScriptLanguage Property