ActiveReports 11
LoadReport(FileInfo) Method
Example 

GrapeCity.ActiveReports.Design.Win.v11 Assembly > GrapeCity.ActiveReports.Design Namespace > Designer Class > LoadReport Method : LoadReport(FileInfo) Method
File containing section or page report.
Loads an existing report XML layout from the specified file name into the designer.
Syntax
'Declaration
 
Public Overloads Sub LoadReport( _
   ByVal file As FileInfo _
) 
public void LoadReport( 
   FileInfo file
)

Parameters

file
File containing section or page report.
Example
/// <summary>
/// OpenReportFile - [ファイルを開く]ダイアログを開き、レポートのrpxファイルを選択して開きます。
/// </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;

            //開かれたレポートを、最新のキャッシュに追加します
            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;

                //行を作成します
                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);
            }
    
            //レポートをロードします
            this.ardMain.LoadReport(new System.IO.FileInfo(this._savedPath));
        }

        //デザイナのコンボボックスを埋めます
        this.FillCombo();
        
    }
    catch(System.IO.IOException ex)
    {
        MessageBox.Show(ex.ToString());
    }
}
'OpenReportFile - [ファイルを開く]ダイアログを開き、レポートのrpxファイルを選択して開きます。
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

            '開かれたレポートを、最新のキャッシュに追加します
            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

                '行を作成します
                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

            'レポートをロードします
            Me.ardMain.LoadReport(Me._savedPath)
        End If

        'デザイナのコンボボックスを埋めます
        Me.FillCombo()

    Catch ex As System.IO.IOException
        MessageBox.Show(ex.ToString())
    End Try
End Sub
See Also

Reference

Designer Class
Designer Members
Overload List