[]
Although ActiveReports writes report layouts in either C# or Visual Basic.NET, you can save the layout of your report as a report XML (RPX) file for portability. If you make changes to the RPX file and load it back into an ActiveReport in Visual Studio, you can see the changes you made reflected in the C# or Visual Basic.NET code in the YourReportName.Designer.vb or YourReportName.Designer.cs file.
type=warning
Caution: When you load an RPX layout into a report object, it overwrites everything in the report object. In order to avoid overwriting important layouts, add a new blank ActiveReport and load the RPX file onto it.
type=note
Note: The Report menu in Visual Studio 2019 and above is available as submenu under Extensions. You should select the Design View of the report in the ActiveReports Designer first.
type=note
Note: When you save a layout that contains a dataset, ActiveReports saves the data adapter and data connection in the component tray, but not the dataset itself. When the saved layout is loaded into another report, you can regenerate the dataset with the data adapter and data connection.
Use the SaveLayout(XmlWriter) method to save your report layout at run time.
type=note
Note: When you save a report layout, ActiveReports only saves the code in the script editor to the file. Any code behind the report in the .cs or .vb file is not saved to the RPX file.
Right-click the Windows Form and select View Code to see the code view for the Windows form.
Add the following code to the Form class to save the report.
The following example shows what the code for the method looks like.
Dim rpt As New SectionReport1()
Dim xtw As New System.Xml.XmlTextWriter(Application.StartupPath + "\report.rpx", Nothing)
rpt.SaveLayout(xtw)
xtw.Close()
SectionReport1 rpt = new SectionReport1();
System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter(Application.StartupPath + "\\report.rpx", null);
rpt.SaveLayout(xtw);
xtw.Close();
Save report layouts before they run. If you save a layout after the report runs, you also save any dynamic changes made to properties or sections in the report. To avoid this when you call SaveLayout inside the report code, use the ReportStart event.
type=note
Note: The SaveLayout method uses utf-16 encoding when you save to a stream, and utf-8 encoding when you save to a file.