FlexReport Quick Start > Step 2 of 2: Loading and Rendering the Report |
![]() |
Note: Adding FlexReport.SQLite project as a reference to your app's project is required for FlexReport to be able to use SQLite. FlexReport.SQLite works as a wrapper that allows the FlexReport assembly to avoid having a hard reference to SQLite. |
Private Sub Page_Loaded(sender As Object, e As RoutedEventArgs) ' Copy the SQLite database file from app's Assets to LocalFolder - in a .FLXR report def, ' it can be referenced as ?(SpecialFolder.SystemDefault): ' Data Source=?(SpecialFolder.SystemDefault)\C1NWind.db ' When designing the report, ?(SpecialFolder.SystemDefault) refers to Environment.SpecialFolder.MyDocuments, so you can ' put the report database file in your MyDocuments folder to conveniently design and test run your reports: Dim dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "C1NWind.db") If Not File.Exists(dbPath) Then File.Copy("Assets\C1NWind.db", dbPath) End If ' Create and load the report: Dim report As New C1FlexReport() Using fs As Stream = File.OpenRead("Assets/ProductsUWP.flxr") report.Load(fs, "ProductList") End Using ' Assign the report to the viewer's DocumentSource - it will be generated automatically ' (asynchronously by default) when the viewer shows it: Me.flexViewer.DocumentSource = report End Sub
private async void Page_Loaded(object sender, RoutedEventArgs e) { // Copy the SQLite database file from app's Assets to LocalFolder-in .FLXR report definition var dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "C1NWind.db"); if (!File.Exists(dbPath)) File.Copy(@"Assets\C1NWind.db", dbPath); // Create and load the report: C1FlexReport report = new C1FlexReport(); using (Stream fs = File.OpenRead("Assets/ProductsUWP.flxr")) report.Load(fs, "ProductList"); // Assign the report to the viewer's DocumentSource - it will be generated automatically // (asynchronously by default) when the viewer shows it: this.flexViewer.DocumentSource = report; }