Udostępnij za pośrednictwem


Klasa LocalReport

Represents a report that is processed and rendered locally without connecting to a report server.

Hierarchia dziedziczenia

Object
  Microsoft.Reporting.WebForms.Report
    Microsoft.Reporting.WebForms.LocalReport

Przestrzeń nazw:  Microsoft.Reporting.WebForms
Zestaw:  Microsoft.ReportViewer.WebForms (w Microsoft.ReportViewer.WebForms.dll)

Składnia

'Deklaracja
<SerializableAttribute> _
Public NotInheritable Class LocalReport _
    Inherits Report _
    Implements ISerializable, IDisposable
[SerializableAttribute]
public sealed class LocalReport : Report, 
    ISerializable, IDisposable
[SerializableAttribute]
public ref class LocalReport sealed : public Report, 
    ISerializable, IDisposable
[<Sealed>]
[<SerializableAttribute>]
type LocalReport =  
    class
        inherit Report
        interface ISerializable
        interface IDisposable
    end
public final class LocalReport extends Report implements ISerializable, IDisposable

Typ LocalReport uwidacznia następujące elementy członkowskie.

Konstruktorzy

  Nazwa Opis
Metoda publiczna LocalReport Inicjuje nowe wystąpienie klasy LocalReport.

Początek

Właściwości

  Nazwa Opis
Właściwość publiczna DataSources Gets a collection of data sources used by the report.
Właściwość publiczna DisplayName Gets or sets the display name of the report. (Odziedziczone z Report).
Właściwość publiczna EnableExternalImages Indicates whether the report can be rendered if it has external images.
Właściwość publiczna EnableHyperlinks Indicates whether the report can be rendered if it contains hyperlink actions.
Właściwość publiczna IsDrillthroughReport Indicates whether the report is a drillthrough report. (Odziedziczone z Report).
Właściwość publiczna IsReadyForRendering Gets a Boolean value that indicates whether a report definition and all parameters have been specified, and all data sources are ready for use. (Odziedziczone z Report).
Właściwość publiczna MapTileServerConfiguration Defines configuration settings for Microsoft Bing Maps SOAP Services that provides a tile background for map report items in the report.
Właściwość publiczna OriginalParametersToDrillthrough Returns the parameters passed from a parent report to this report, if it is a drillthrough report.
Właściwość publiczna ReportEmbeddedResource Gets or sets the name of the report embedded resource.
Właściwość publiczna ReportPath Gets or sets the local file system path of the local report.
Właściwość publiczna ShowDetailedSubreportMessages Gets or sets a Boolean value that indicates whether detailed messages should be displayed when an error occurs in a subreport.

Początek

Metody

  Nazwa Opis
Metoda publiczna AddFullTrustModuleInSandboxAppDomain Adds the supplied assembly to the list of assemblies that run in full trust mode in the sandboxed application domain.
Metoda publiczna AddTrustedCodeModuleInCurrentAppDomain Nieaktualne. Adds the supplied assembly to the list of assemblies that are trusted to execute in the current AppDomain.
Metoda publiczna Dispose Releases all resources that are used by the LocalReport object.
Metoda publiczna Equals Determines whether the specified object is equal to the current object. (Odziedziczone z Object).
Metoda publiczna ExecuteReportInCurrentAppDomain Nieaktualne. Causes processing extensions and expressions in the report to be executed in the current AppDomain.
Metoda publiczna ExecuteReportInSandboxAppDomain Nieaktualne. Causes processing extensions and expressions to be run with limited permissions in an application domain.
Metoda publiczna GetDataSourceNames Returns the names of all datasets used within the local report.
Metoda publiczna GetDefaultPageSettings Gets the default page settings specified in the local report. (Zastępuje Report.GetDefaultPageSettings()).
Metoda publiczna GetDocumentMap Returns the representation of the document map for the local report. (Odziedziczone z Report).
Metoda publiczna GetHashCode Serves as the default hash function. (Odziedziczone z Object).
Metoda publiczna GetParameters Returns report parameter properties for the report. (Zastępuje Report.GetParameters()).
Metoda publiczna GetTotalPages() Returns the total number of soft pages in the report. (Odziedziczone z Report).
Metoda publiczna GetTotalPages(PageCountMode%) Returns the total number of soft pages in the report and a PageCountMode enumeration value that indicates the current page count mode. (Zastępuje Report.GetTotalPages(PageCountMode%)).
Metoda publiczna GetType Gets the Type of the current instance. (Odziedziczone z Object).
Metoda publiczna ListRenderingExtensions Returns all available rendering extensions for the local report. (Zastępuje Report.ListRenderingExtensions()).
Metoda publiczna LoadReportDefinition(TextReader) Loads a report definition from the local file system using a TextReader. (Zastępuje Report.LoadReportDefinition(TextReader)).
Metoda publiczna LoadReportDefinition(Stream) Loads a report definition for processing using a Stream. (Odziedziczone z Report).
Metoda publiczna LoadSubreportDefinition(String, Stream) Loads a subreport definition using a Stream.
Metoda publiczna LoadSubreportDefinition(String, TextReader) Loads a subreport definition using a TextReader.
Metoda publiczna Refresh Causes the local report to be rendered with new data. (Zastępuje Report.Refresh()).
Metoda publiczna ReleaseSandboxAppDomain Causes the LocalReport object to release its reference to the sandboxed application domain immediately.
Metoda publiczna Render(String) Processes the report and renders it in the specified format. (Odziedziczone z Report).
Metoda publiczna Render(String, String) Processes the report and renders it in the specified format. (Odziedziczone z Report).
Metoda publiczna Render(String, String, CreateStreamCallback, array<Warning[]%) Processes the report and renders it in the specified format using a stream provided by a callback function.
Metoda publiczna Render(String, String, PageCountMode, CreateStreamCallback, array<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.
Metoda publiczna Render(String, String, String%, String%, String%, array<String[]%, array<Warning[]%) Processes the report and renders it in the specified format. (Odziedziczone z Report).
Metoda publiczna Render(String, String, PageCountMode, String%, String%, String%, array<String[]%, array<Warning[]%) Processes the report with a specified page count mode and renders it in the specified format. (Zastępuje Report.Render(String, String, PageCountMode, String%, String%, String%, array<String[]%, array<Warning[]%)).
Metoda publiczna SetBasePermissionsForSandboxAppDomain Sets the base permissions for the sandboxed application domain with the supplied permission set.
Metoda publiczna SetParameters(IEnumerable<ReportParameter>) Sets report parameter properties for the local report. (Zastępuje Report.SetParameters(IEnumerable<ReportParameter>)).
Metoda publiczna SetParameters(ReportParameter) Sets report parameter properties for the report. (Odziedziczone z Report).
Metoda publiczna ToString Returns a string that represents the current object. (Odziedziczone z Object).

Początek

Zdarzenia

  Nazwa Opis
Zdarzenie publiczne SubreportProcessing Occurs when a subreport is processed.

Początek

Jawne implementacje interfejsu

  Nazwa Opis
Jawna implementacja interfejsuMetoda prywatna ISerializable.GetObjectData

Początek

Uwagi

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 non-visual 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

Przykłady

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

protected void Button1_Click(object sender, EventArgs e)
{

   Microsoft.Reporting.WebForms.LocalReport lr = 
     new Microsoft.Reporting.WebForms.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);
      }
}
Protected Sub Button1_Click(ByVal sender As 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()

   Dim lr As New Microsoft.Reporting.WebForms.LocalReport

   lr.ReportPath = "C:\My Reports\Monthly Sales.rdlc"

   lr.DataSources.Add(New ReportDataSource("Sales", GetSalesData()))

   deviceInfo = _
"<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"

   bytes = ReportViewer1.LocalReport.Render("Excel", deviceInfo,_
      mimeType, encoding, extension, streamids, warnings)

   Dim fs As New FileStream("c:\output.xls", FileMode.Create)
   fs.Write(bytes, 0, bytes.Length)

End Sub

Bezpieczeństwo wątku

Wszystkie publiczne static (Shared w języku Visual Basic) elementy członkowskie tego typu są bezpieczne dla wątków. Wystąpienia elementów członkowskich nie dają gwarancji bezpieczeństwa wątków.

Zobacz też

Informacje

Przestrzeń nazw Microsoft.Reporting.WebForms