LocalReport Class
Represents a report that is processed and rendered locally without connecting to a report server.
Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in Microsoft.ReportViewer.WinForms.dll)
Inheritance Hierarchy
System.Object
Microsoft.Reporting.WinForms.Report
Microsoft.Reporting.WinForms.LocalReport
Syntax
[SerializableAttribute]
public sealed class LocalReport : Report, ISerializable, IDisposable
[SerializableAttribute]
public ref class LocalReport sealed : Report, ISerializable,
IDisposable
[<Sealed>]
[<SerializableAttribute>]
type LocalReport =
class
inherit Report
interface ISerializable
interface IDisposable
end
<SerializableAttribute>
Public NotInheritable Class LocalReport
Inherits Report
Implements ISerializable, IDisposable
Constructors
Name | Description | |
---|---|---|
LocalReport() | Initializes a new instance of the LocalReport class. |
Properties
Name | Description | |
---|---|---|
DataSources | Gets a collection of data sources used by the report. |
|
DisplayName | Gets or sets the display name of the report.(Inherited from Report.) |
|
EnableExternalImages | Indicates whether the report can be rendered if it has external images. |
|
EnableHyperlinks | Indicates whether the report can be rendered if it contains hyperlink actions. |
|
IsDrillthroughReport | Indicates whether the report is a drillthrough report.(Inherited from Report.) |
|
IsReadyForRendering | Gets a Boolean value that indicates whether a report definition and all required parameters have been specified, and all data sources are ready for use. (Inherited from Report.) |
|
MapTileServerConfiguration | Defines configuration settings for Microsoft Bing Maps SOAP Services that provides a tile background for map report items in the report. |
|
OriginalParametersToDrillthrough | Returns the parameters passed from a parent report to this report, if it is a drillthrough report. |
|
ReportEmbeddedResource | Gets or sets the name of the report-embedded resource. |
|
ReportPath | Gets or sets the file system path of the local report. |
|
ShowDetailedSubreportMessages | Gets or sets a boolean value that indicates whether detailed messages should be displayed when an error occurs in a subreport. |
Methods
Name | Description | |
---|---|---|
AddFullTrustModuleInSandboxAppDomain(StrongName) | Adds the supplied assembly to the list of assemblies that run in full trust mode in the sandboxed application domain. |
|
AddTrustedCodeModuleInCurrentAppDomain(String) | Obsolete.Adds the supplied assembly to the list of assemblies that are trusted to execute in the current AppDomain. |
|
Dispose() | Releases all resources that are used by the LocalReport object. |
|
Equals(Object) | (Inherited from Object.) |
|
ExecuteReportInCurrentAppDomain(Evidence) | Obsolete.Causes processing extensions and expressions in the report to be executed in the current AppDomain. |
|
ExecuteReportInSandboxAppDomain() | Obsolete.Causes processing extensions and expressions to be run in an application domain with limited permissions. |
|
GetDataSourceNames() | Returns the names of all datasets used within the local report. |
|
GetDefaultPageSettings() | Gets the default page settings specified in the local report.(Overrides Report.GetDefaultPageSettings().) |
|
GetDocumentMap() | Returns the representation of the document map for the local report.(Inherited from Report.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetParameters() | Returns report parameter properties for the report. (Overrides Report.GetParameters().) |
|
GetTotalPages() | Returns the total number of soft pages in the report. (Inherited from Report.) |
|
GetTotalPages(PageCountMode) | Returns the total number of soft pages in the report and a PageCountMode enumeration value that indicates the current page count mode.(Overrides Report.GetTotalPages(PageCountMode).) |
|
GetType() | (Inherited from Object.) |
|
ListRenderingExtensions() | Returns all available rendering extensions for the local report.(Overrides Report.ListRenderingExtensions().) |
|
LoadReportDefinition(Stream) | Loads a report definition for processing using a Stream.(Inherited from Report.) |
|
LoadReportDefinition(TextReader) | Loads a report definition from the local file system using a TextReader.(Overrides Report.LoadReportDefinition(TextReader).) |
|
LoadSubreportDefinition(String, Stream) | Loads a subreport definition using a Stream. |
|
LoadSubreportDefinition(String, TextReader) | Loads a subreport definition using a TextReader. |
|
Refresh() | Causes the local report to be rendered with new data.(Overrides Report.Refresh().) |
|
ReleaseSandboxAppDomain() | Causes the LocalReport object to release its reference to the sandboxed application domain immediately. |
|
Render(String) | Processes the report and renders it in the specified format.(Inherited from Report.) |
|
Render(String, String) | Processes the report and renders it in the specified format.(Inherited from Report.) |
|
Render(String, String, CreateStreamCallback, Warning[]) | Processes the report and renders it in the specified format using a stream provided by a callback function. |
|
Render(String, String, PageCountMode, CreateStreamCallback, Warning[]) | Processes the report with a specified page count mode and renders it in the specified format using a stream provided by a callback function. |
|
Render(String, String, PageCountMode, String, String, String, String[], Warning[]) | Processes the report with a specified page count mode and renders it in the specified format.(Overrides Report.Render(String, String, PageCountMode, String, String, String, String[], Warning[]).) |
|
Render(String, String, String, String, String, String[], Warning[]) | Processes the report and renders it in the specified format.(Inherited from Report.) |
|
SetBasePermissionsForSandboxAppDomain(PermissionSet) | Sets the base permissions for the sandboxed application domain with the supplied permission set. |
|
SetParameters(IEnumerable<ReportParameter>) | Sets report parameter properties for the local report.(Overrides Report.SetParameters(IEnumerable<ReportParameter>).) |
|
SetParameters(ReportParameter) | Sets report parameter properties for the report.(Inherited from Report.) |
|
ToString() | (Inherited from Object.) |
Events
Name | Description | |
---|---|---|
SubreportProcessing | Occurs when a subreport is processed. |
Explicit Interface Implementations
Name | Description | |
---|---|---|
ISerializable.GetObjectData(SerializationInfo, StreamingContext) |
Remarks
The LocalReport class represents reports that are processed and rendered locally without connecting to a report server. This class is the same object that is used by the ReportViewer control, but it also can be used independently as a nonvisual object that encapsulates the core functionality of the ReportViewer control.
The LocalReport object can open client report definition (RDLC) files from the file system or from embedded resources, or the RDLC file can be supplied to it as a Stream or a TextReader.
The LocalReport object does not have the ability to execute queries or fetch data; instead, data sources must be added to the DataSources collection property.
The LocalReport object supports report parameters, but does not support parameter prompts.
Examples
Legacy Code Example
In the following code example, a LocalReport object is used to load and export a report.
private void button1_Click(object sender, EventArgs e)
{
Microsoft.Reporting.WinForms.LocalReport lr = new Microsoft.Reporting.WinForms.LocalReport();
string deviceInfo =
"<DeviceInfo>" +
"<SimplePageHeaders>True</SimplePageHeaders>" +
"</DeviceInfo>";
lr.ReportPath = @"C:\My Reports\Monthly Sales.rdlc";
lr.DataSources.Add(new ReportDataSource("Sales", GetSalesData()));
byte[] bytes = lr.Render("Excel", deviceInfo, out mimeType,
out encoding, out streamids, out warnings);
using (FileStream fs = = new FileStream(@"c:\My Reports\Monthly Sales.xls", FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}
}
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim deviceInfo as string
Dim bytes As Byte()
deviceInfo = "< deviceInfo ><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"
bytes = ReportViewer1.LocalReport.Render("Excel", Nothing, _
mimeType,encoding, extension, streamids, warnings)
Dim fs As New FileStream("c:\output.xls", FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
MessageBox.Show("Report exported to output.xls", "Info")
End Sub
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Microsoft.Reporting.WinForms Namespace
Return to top