[]
Loads an existing report from the specified file into the designer.
public void LoadReport(FileInfo fileInfo)
Type | Name | Description |
---|---|---|
FileInfo | fileInfo | FileInfo wrapper for the section or page report to load. The report file should be in XML format and compatible with the ActiveReports designer. |
This method opens a report from a file, allowing the user to edit the report's design within the ActiveReports designer environment. It supports
both section and page report types. Ensure that the file specified by fileInfo
exists and is accessible.
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
FileNotFoundException | Thrown when the file specified in |
Loads an existing report from a stream into the designer. This method is obsolete.
[Obsolete("This method has been deprecated. Please, use LoadReport(XmlReader,DesignerReportType) method instead")]
public void LoadReport(Stream stream)
Type | Name | Description |
---|---|---|
Stream | stream | A stream containing the report data. This can be either a section report or a page report. |
Loads an existing report of the specified type from the provided System.Xml.XmlReader into the designer.
public void LoadReport(XmlReader reader, DesignerReportType type)
Type | Name | Description |
---|---|---|
XmlReader | reader | An System.Xml.XmlReader instance that reads the report XML data. This can be either a section report or a page report. |
DesignerReportType | type | The type of the report being loaded, specified by the DesignerReportType enumeration. This determines how the report is processed and displayed in the designer. |
This method allows for more flexible report loading by accepting an System.Xml.XmlReader, which can be used to load reports from various sources, including streams, strings, or files.
The following example demonstrates how to load a report from a string containing XML data:
var report = new PageReport {
Report = {
DataSources = {
new DataSource {
Name = "MainDataSource",
ConnectionProperties = {
ConnectString = "your_connection_string",
DataProvider = "MSSQL",
}
}
}
}
};
//Serialize and load report into the designer
designer.LoadReport(XmlReader.Create(new StringReader(report.ToRdlString())), DesignerReportType.Rdl);
Loads an existing report of the specified type and name from the provided System.Xml.XmlReader into the designer.
public void LoadReport(XmlReader reader, DesignerReportType type, string reportName)
Type | Name | Description |
---|---|---|
XmlReader | reader | An System.Xml.XmlReader instance that reads the report XML data. This can be either a section report or a page report. |
DesignerReportType | type | The type of the report being loaded, specified by the DesignerReportType enumeration. This determines how the report is processed and displayed in the designer. |
string | reportName | The name of the report. This parameter can be used to specify a name for the report being loaded. If null or empty, the name may be derived from the XML content or remain unspecified. |
This overload of the LoadReport
method provides an additional parameter for specifying the name of the report. This can be useful for identifying
the report within the designer environment, especially when working with multiple reports or when the report's name is not defined within the XML structure.
The following example demonstrates how to load a report from a string containing XML data, specifying a name for the report:
// Assume that 'pageReport' is a PageReport object containing the report layout
using (var designer = new Designer())
{
var xml = new StringBuilder();
using (XmlWriter xmlWriter = XmlWriter.Create(xml))
pageReport.Save(xmlWriter);
using (XmlReader xmlReader = XmlReader.Create(new StringReader(xml.ToString())))
designer.LoadReport(xmlReader, DesignerReportType.Page, "MyCustomReportName");
}