xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-d6678f0b.md
Specifies the report scripts.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[Browsable(false)]
[DefaultValue("")]
public string ScriptsSource { get; set; }
<DefaultValue("")>
<Browsable(False)>
Public Property ScriptsSource As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A String value, storing the code of all report scripts.
|
Use the ScriptsSource property to assign or access report scripts at runtime.
Before assigning the XtraReport.ScriptsSource in code, make sure to specify the XRControl.Name for each added report control. Otherwise, running the script will cause an exception, because the default control name is undefined.
The following code illustrates the correct approach.
XtraReport report = new XtraReport();
report.Bands.Add(new DetailBand());
XRLabel label1 = new XRLabel();
label1.Name = "label1";
report.Bands[0].Controls.Add(label1);
XRLabel label2 = new XRLabel();
label2.Name = "label2";
report.Bands[0].Controls.Add(label2);
this.ScriptsSource = "int i = 0;";
ReportPrintTool pt = new ReportPrintTool(report);
pt.ShowPreviewDialog();
Dim report As New XtraReport()
report.Bands.Add(New DetailBand())
Dim label1 As New XRLabel()
label1.Name = "label1"
report.Bands(0).Controls.Add(label1)
Dim label2 As New XRLabel()
label2.Name = "label2"
report.Bands(0).Controls.Add(label2)
Dim pt As New ReportPrintTool(report)
pt.ShowPreviewDialog()
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ScriptsSource property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-reporting-create-a-custom-script-editor-designer/CS/Program.cs#L16
var report = new XtraReport();
report.ScriptsSource = "// write code here\r\n";
report.ScriptLanguage = DevExpress.XtraReports.ScriptLanguage.CSharp;
winforms-reporting-create-a-custom-script-editor-designer/VB/Program.vb#L16
Dim report = New XtraReport()
report.ScriptsSource = "// write code here" & vbCrLf
report.ScriptLanguage = DevExpress.XtraReports.ScriptLanguage.CSharp
See Also