Parameters
- name
- Name of the new object (case-insensitive).
- value
- Value of the new object.
This method allows you to add custom objects to the context of the C1Report script interpreter.
The script interpreter context is cleared whenever a report starts rendering, so this method should always be called from the StartReport event handler.
The code below uses the StartReport event to add a variable called "mainForm" to the script context. It then attaches some script to the report's OnOpen event to show the caption of the form when the report starts rendering.
private void _c1r_StartReport(object sender, System.EventArgs e) { _c1r.AddScriptObject("mainForm", this); } private void button1_Click(object sender, System.EventArgs e) { _c1r.OnOpen = "msgbox(mainForm.Text)"; _c1r.Render(); }