C1ReportViewer Task-Based Help > Loading Documents into C1ReportViewer > Loading Documents from Application Resources (Silverlight) |
You can easily load a document from an application resource. For example, complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Imports C1.Silverlight|variable=Silverlight.ReportViewer
|
C# |
Copy Code
|
---|---|
using C1.Silverlight|variable=Silverlight.ReportViewer;
|
Visual Basic |
Copy Code
|
---|---|
Public Sub New() InitializeComponent() Dim resource = Application.GetResourceStream(New Uri("AppName;component/resource.pdf", UriKind.Relative)) Me.C1ReportViewer1.LoadDocument(resource.Stream) End Sub |
C# |
Copy Code
|
---|---|
public MainPage() { InitializeComponent(); var uri = new Uri("/AppName;component/resource.pdf", UriKind.Relative); var resource = Application.GetResourceStream(uri); this.C1ReportViewer1.LoadDocument(resource.Stream); } |
This code adds a stream and loads the stream into the C1ReportViewer control. Note that if you named the application differently, you will need to replace "AppName" with the name of your project. If you added a different PDF file, replace "resource.pdf" with the name of your file.