ReportMachine OCX 的使用方法


http://rmachine.haotui.com/thread-55-1-1.html

RMReport.ocx

RMEngine.Init(1); // 初始化
RMEngine.LoadFromFile('c:\1.rmf'); // 讀入報表模版
RMEngine.AddDataSet(DataModule2.Customers, 'CustomersDS'); // 增加一個數據表
RMEngine.DesignReport; // 設計報表
RMReport.ShowReport; // 預覽報表 

 

c#調用

復制代碼
this.dataSet1 = new System.Data.DataSet();
this.dataView1 = new System.Data.DataView();
this.rmReport1 = new RMReportEngine.RMReport();
this.dataSet1.Reset();

            this.oleDbDataAdapter1.SelectCommand.CommandText = "select * from Customer";
            this.oleDbDataAdapter1.Fill(this.dataSet1, "Customer");
            this.dataView1.Table = this.dataSet1.Tables["Customer"];
            this.dataView1.RowFilter = "CustNo >= 3000";
            //this.dataGrid1.DataSource = this.dataView1;

            rmReport1.ModifyPrepared = false;
            rmReport1.Init(this, TxRMReportType.rmrtReport);
            //rmReport1.PreviewOptions.BtnDesignVisible = true;
            //rmReport1.AddDataSet(this.dataSet1.Tables["Customer"], "db1");
            rmReport1.AddDataSet(this.dataView1, "db1");
            rmReport1.LoadFromFile(MainPath + "reports\\SimpleList.rmf"); //SimpleList.rmf

            rmReport1.AddVariable("公司名稱", "我的公司名稱", true);
            rmReport1.AddVariable("公司簡稱", "我的公司簡稱", true);
            rmReport1.AddVariable("公司電話", "我的公司電話", true);

            if (radioButton1.Checked)
            {
                    rmReport1.ShowReport();
            }
            else
            {
                rmReport1.DesignReport();
            }
復制代碼

 

 

public void AddDataSet(System.Data.DataView aDataView, string aDatasetName)

public void AddDataSet(System.Data.DataTable aDataTable, string aDatasetName)

public void AddDetailDataSet(System.Data.DataTable aDataTable, string aDatasetName, string aMasterName, System.Data.DataRelation aDataRelation)

public void AddVariable(string aVarName, object aVarValue, bool aIsString)

public void GetReportData(ref string aReportData)

public void Init(System.Windows.Forms.Form aOwner, RMReportEngine.RMReportType aReportType)

 

 

web版 RMViewer.ocx

http://rmachine.haotui.com/thread-56-1-1.html

編譯client_ActiveForm目錄中的項目就會生成RMViewer.ocx

 

com版本

COM控件(ocx)可以在VB、.Net、VC、Delphi等支持ADO的開發工具中使用

ocx版本

復制代碼
Dim conn
    Dim rs
    Dim sql
    Dim rq
    Dim Engine

    Set conn = OpenDBConnection
    Set rs = Server.CreateObject ("ADODB.recordset")
    sql = "SELECT * from customer"
    rs.Open sql, conn, 1, 1

    Set Engine = Server.CreateObject("RMEngine.Engine")
    Engine.Init
    Engine.AddDataSet "db1", rs
    Engine.SetReportFile RootPath & "SimpleList.rmf"
    Engine.ViewerVersion = ViewerVersion
    Engine.ViewerFileName = ViewerFileName
    Engine.SaveReportURL = "asp/DesignReportSave.asp?Report=" & "SimpleList.rmf" 
    Engine.AddVariable "NowTime", Now, false

    Engine.ShowProgress = True

    Set rs = nothing
    conn.Close
    Set conn = nothing
復制代碼


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM