GrapeCity.ActiveReports.Design.Win.v8 Assembly > GrapeCity.ActiveReports.Design Namespace > Designer Class > LoadReport Method : LoadReport(FileInfo) Method |
'Declaration Public Overloads Sub LoadReport( _ ByVal file As System.IO.FileInfo _ )
public void LoadReport( System.IO.FileInfo file )
/// <summary> /// OpenReportFile - opens the Open File dialog box to select and open a report rpx file /// </summary> private void OpenReportFile() { try { this.dlgOpenFile.Filter = "ActiveReport Report Design (RPX) (*.rpx)|*.rpx"; this.dlgOpenFile.FilterIndex = 2; this.dlgOpenFile.RestoreDirectory = true ; this.dlgOpenFile.DefaultExt = ".rpx"; if(dlgOpenFile.ShowDialog() == DialogResult.OK) { this._alreadySaved = true; //Add opened report to the opened report recent cache if(System.IO.File.Exists(Application.StartupPath + @"\Settings\recent.xml")) { DataSet _reportsDS = new DataSet(); _reportsDS.Locale = CultureInfo.InvariantCulture; _reportsDS.ReadXml(Application.StartupPath + @"\Settings\recent.xml"); DataTable _reportsTable = _reportsDS.Tables["Reports"]; _reportsTable.Locale = CultureInfo.InvariantCulture; //Create a Row DataRow _rowReports = _reportsTable.NewRow(); object [] _myArray = new object[2]; this._savedPath = this.dlgOpenFile.FileName; _myArray[0] = this.dlgOpenFile.FileName; _myArray[1] = System.DateTime.Now; _rowReports.ItemArray = _myArray; _reportsTable.Rows.Add(_rowReports); _reportsDS.WriteXml(Application.StartupPath + @"\Settings\recent.xml", XmlWriteMode.WriteSchema); } //Load the Report this.ardMain.LoadReport(this._savedPath); } //Fill the designer combo boxes this.FillCombo(); } catch(System.IO.IOException ex) { MessageBox.Show(ex.ToString()); } }
'OpenReportFile - opens the Open File dialog box to select and open a report rpx file Private Sub OpenReportFile() Try Me.dlgOpenFile.Filter = "ActiveReport Report Design (RPX) (*.rpx)|*.rpx" Me.dlgOpenFile.FilterIndex = 2 Me.dlgOpenFile.RestoreDirectory = True Me.dlgOpenFile.DefaultExt = ".rpx" If dlgOpenFile.ShowDialog() = DialogResult.OK Then Me._alreadySaved = True 'Add opened report to the opened report recent cache If System.IO.File.Exists((Application.StartupPath + "\Settings\recent.xml")) Then Dim _reportsDS As New DataSet() _reportsDS.Locale = CultureInfo.InvariantCulture _reportsDS.ReadXml((Application.StartupPath + "\Settings\recent.xml")) Dim _reportsTable As DataTable = _reportsDS.Tables("Reports") _reportsTable.Locale = CultureInfo.InvariantCulture 'Create a Row Dim _rowReports As DataRow = _reportsTable.NewRow() Dim _myArray(1) As Object Me._savedPath = Me.dlgOpenFile.FileName _myArray(0) = Me.dlgOpenFile.FileName _myArray(1) = System.DateTime.Now _rowReports.ItemArray = _myArray _reportsTable.Rows.Add(_rowReports) _reportsDS.WriteXml(Application.StartupPath + "\Settings\recent.xml", XmlWriteMode.WriteSchema) End If 'Load the Report Me.ardMain.LoadReport(Me._savedPath) End If 'Fill the designer combo boxes Me.FillCombo() Catch ex As System.IO.IOException MessageBox.Show(ex.ToString()) End Try End Sub 'OpenReportFile