Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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)

'Declaration
<SerializableAttribute> _
Public NotInheritable Class LocalReport
	Inherits Report
	Implements ISerializable, IDisposable
'Usage
Dim instance As LocalReport

/** @attribute SerializableAttribute() */ 
public final class LocalReport extends Report implements ISerializable, IDisposable
SerializableAttribute 
public final class LocalReport extends Report implements ISerializable, IDisposable

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.

In the following code example, a LocalReport object is used to load and export a report.

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

System.Object
   Microsoft.Reporting.WinForms.Report
    Microsoft.Reporting.WinForms.LocalReport

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft