1、在ActiveReport2.0中怎樣生成*.rpx報表模板文件,它好象沒有水晶報表哀9.0那樣的設計器是嗎,那怎樣生成*.rpx文件?
2、在VB中怎樣調用*.rpx的模板文件,謝謝!
大俠有空請寄一例到[email protected],謝謝!

解决方案 »

  1.   

    arp2.0也有几个版本,设计器在专业版里面有,标准版里是没有的。安装完专业版在vb里面会有一个runtimedisigner,他的save和load就是rpx文件。rpx文件实际上就是一个xml文件,你用记事本可以打开,如果不用arp的设计器的话,理论上可以用些文本的方式按照他的格式自己生成一个,存成rpx扩展名,应该也可以使用的。
      

  2.   

    我也感觉 不清楚.Rpx只有控件,没有代码.
    不知如何搞.
      

  3.   

    我已經知道怎樣生成*.rpx的文件,但是不知道在vb中怎樣調用*.rpx,
    請大俠指點!
      

  4.   

    '工具栏事件
    Private Sub ABar_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
    Dim rpt As DDActiveReports2.ActiveReport
    Set rpt = New ActiveReport
    '显示字体等工具
    ARD.ToolbarsVisible = ddTBPropertyToolbox
    ARD.ToolbarsAccessible = ddTBPropertyToolbox
    Select Case Tool.Name
    Case "named": '重命名
       rename.Show 1
    Case "reload": '
        rpt.LoadLayout (App.Path & "\exfmt\fmt00.rpx")
        ARD.LoadFromObject rptCase "options" '选项设置
       F_DSG.Show 1Case "save": '保存格式If Len(Trim(fmtlist.Cell(flexcpText, fmtlist.RowSel, 1))) = 0 Then '如果别名为空,不保存
       MsgBox Prompt:="尚未指定格式名称,无法保存!", Buttons:=vbOKOnly + vbExclamation, Title:="系统提示"
    Else
        ARD.SaveToObject rpt
        rpt.SaveLayout App.Path & "\exfmt\" & fmtlist.Cell(flexcpText, fmtlist.RowSel, 2), ddSOFile
    End IfCase "print": '
        rpt.LoadLayout (App.Path & "\exfmt\" & fmtlist.Cell(flexcpText, fmtlist.RowSel, 2))
        ARD.LoadFromObject rpt    ARD.Report.PrintReport TrueCase "quit": '
       Unload Me
    End Select
    End Sub以前一个项目的,保存,载入都有了.
      

  5.   

    很简单的,步骤如下:
    1、新建vb工程,部件里选取arp的那个runtime designer,保存工程;不要更改form1的默认名称;
    2、在form1上放3个command button,也不要改默认名字;
    、用记事本打开form1.frm,把下面代码粘进去:
    VERSION 5.00
    Object = "{E281C260-6F27-11D1-8AF0-00A0C98CD92B}#2.0#0"; "ardespro2.dll"
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   7065
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   9180
       LinkTopic       =   "Form1"
       ScaleHeight     =   7065
       ScaleWidth      =   9180
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command3 
          Caption         =   "Close"
          Height          =   375
          Left            =   2640
          TabIndex        =   2
          Top             =   120
          Width           =   1335
       End
       Begin VB.CommandButton Command2 
          Caption         =   "Load Rpx2"
          Height          =   375
          Left            =   1320
          TabIndex        =   1
          Top             =   120
          Width           =   1335
       End
       Begin VB.CommandButton Command1 
          Caption         =   "Load Rpx1"
          Height          =   375
          Left            =   0
          TabIndex        =   0
          Top             =   120
          Width           =   1335
       End
       Begin DDActiveReportsDesignerCtl.ARDesigner ARD 
          Height          =   8415
          Left            =   0
          TabIndex        =   3
          Top             =   600
          Width           =   8655
          _ExtentX        =   15266
          _ExtentY        =   14843
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Option Explicit
    Private Sub Command1_Click()
    Dim rpt As DDActiveReports2.ActiveReport
    Set rpt = New ActiveReport
        rpt.LoadLayout (App.Path & "\fmt01.rpx")
        ARD.LoadFromObject rpt
    End Sub
    Private Sub Command2_Click()
    Dim rpt As DDActiveReports2.ActiveReport
    Set rpt = New ActiveReport
        rpt.LoadLayout (App.Path & "\fmt02.rpx")
        ARD.LoadFromObject rpt
    End SubPrivate Sub Command3_Click()
    End
    End SubPrivate Sub Form_Load()
    Dim rpt As DDActiveReports2.ActiveReport
    Set rpt = New ActiveReport
    ARD.LoadFromObject rptEnd Sub
      

  6.   

    3、至于rpx文件,你可以用记事本新建一个空的文本文件,改名,存为fmt01.rpx,放到你刚保存的vb工程目录下面,粘如下代码:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ActiveReportsLayout 
    GUIDLIB="{00000000-0000-0000-0000-000000000000}" GUIDREP="{00000000-0000-0000-0000-000000000000}" 
    LICENSE="10000000"
    PrintWidth="9780"
    DocumentName="ActiveReports Document"
    ScriptLang="VBScript"
    >
    <Water
    >
    </Water>
    <PageSettings>
    </PageSettings>
    <StyleSheet>
    <Style Name="Normal"
    Value="font-family: &apos;Arial&apos;; font-style: normal; font-variant: inherit; font-weight: normal; font-size: 10pt; font-size-adjust: inherit; font-stretch: inherit; color: rgb(0,0,0); background-color: rgb(255,255,255); background-image: inherit; background-repeat: inherit; background-attachment: inherit; background-x-position: inherit; background-y-position: inherit; opacity: inherit; word-spacing: inherit; letter-spacing: inherit; text-decoration: none; vertical-align: inherit; text-transform: inherit; text-align: inherit; text-indent: inherit; unicode-bidi: inherit; line-height: inherit; white-space: inherit; ddo-can-grow: inherit; ddo-can-shrink: inherit; ddo-char-set: 0; "
    />
    <Style Name="Heading1"
    Value="font-family: &apos;inherit&apos;; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 16pt; font-size-adjust: inherit; font-stretch: inherit; "
    />
    <Style Name="Heading2"
    Value="font-family: &apos;Times New Roman&apos;; font-style: italic; font-variant: inherit; font-weight: bold; font-size: 14pt; font-size-adjust: inherit; font-stretch: inherit; "
    />
    <Style Name="Heading3"
    Value="font-family: &apos;inherit&apos;; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 13pt; font-size-adjust: inherit; font-stretch: inherit; "
    />
    <Style Name="Heading4"
    />
    </StyleSheet>
    <Sections>
    <Section Type="PageHeader" Name="标题"
    Height="0"
    >
    </Section>
    <Section Type="Detail" Name="内容"
    Height="2280"
    >
    <Control 
    Type="AR.Label"
    Name="tsuser"
    Left="850"
    Top="709"
    Width="1134"
    Height="283"
    Caption="label1111"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 14pt; color: rgb(0,0,255); "
    >
    </Control>
    <Control 
    Type="AR.Label"
    Name="tstel"
    Left="850"
    Top="1276"
    Width="2552"
    Height="283"
    Caption="test2"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 14pt; color: rgb(0,0,255); "
    >
    </Control>
    <Control 
    Type="AR.Label"
    Name="truser"
    Left="3827"
    Top="709"
    Width="2126"
    Height="283"
    Caption="label 2"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 14pt; color: rgb(0,0,255); text-align: left; "
    >
    </Control>
    <Control 
    Type="AR.Label"
    Name="trtel"
    Left="3969"
    Top="1417"
    Width="1842"
    Height="284"
    Caption="df北京gfgd"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 12pt; color: rgb(0,0,255); "
    >
    </Control>
    </Section>
    <Section Type="PageFooter" Name="尾注"
    Height="0"
    >
    </Section>
    </Sections>
    </ActiveReportsLayout>fmt02.rpx 同样,粘如下代码:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ActiveReportsLayout 
    GUIDLIB="{00000000-0000-0000-0000-000000000000}" GUIDREP="{00000000-0000-0000-0000-000000000000}" 
    LICENSE="10000000"
    PrintWidth="9780"
    DocumentName="ActiveReports Document"
    ScriptLang="VBScript"
    >
    <Water
    >
    </Water>
    <PageSettings>
    </PageSettings>
    <StyleSheet>
    <Style Name="Normal"
    Value="font-family: &apos;Arial&apos;; font-style: normal; font-variant: inherit; font-weight: normal; font-size: 10pt; font-size-adjust: inherit; font-stretch: inherit; color: rgb(0,0,0); background-color: rgb(255,255,255); background-image: inherit; background-repeat: inherit; background-attachment: inherit; background-x-position: inherit; background-y-position: inherit; opacity: inherit; word-spacing: inherit; letter-spacing: inherit; text-decoration: none; vertical-align: inherit; text-transform: inherit; text-align: inherit; text-indent: inherit; unicode-bidi: inherit; line-height: inherit; white-space: inherit; ddo-can-grow: inherit; ddo-can-shrink: inherit; ddo-char-set: 0; "
    />
    <Style Name="Heading1"
    Value="font-family: &apos;inherit&apos;; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 16pt; font-size-adjust: inherit; font-stretch: inherit; "
    />
    <Style Name="Heading2"
    Value="font-family: &apos;Times New Roman&apos;; font-style: italic; font-variant: inherit; font-weight: bold; font-size: 14pt; font-size-adjust: inherit; font-stretch: inherit; "
    />
    <Style Name="Heading3"
    Value="font-family: &apos;inherit&apos;; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 13pt; font-size-adjust: inherit; font-stretch: inherit; "
    />
    <Style Name="Heading4"
    />
    </StyleSheet>
    <Sections>
    <Section Type="PageHeader" Name="标题"
    Height="0"
    >
    </Section>
    <Section Type="Detail" Name="内容"
    Height="2280"
    >
    <Control 
    Type="AR.Label"
    Name="tsuser"
    Left="850"
    Top="709"
    Width="1134"
    Height="283"
    Caption="label1"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 12pt; color: rgb(0,0,255); "
    >
    </Control>
    <Control 
    Type="AR.Label"
    Name="tstel"
    Left="850"
    Top="1276"
    Width="2552"
    Height="283"
    Caption="wd2352wrwf"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 12pt; color: rgb(0,0,255); "
    >
    </Control>
    <Control 
    Type="AR.Label"
    Name="truser"
    Left="3827"
    Top="709"
    Width="2126"
    Height="283"
    Caption="label 2"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 12pt; color: rgb(0,0,255); text-align: left; "
    >
    </Control>
    <Control 
    Type="AR.Label"
    Name="trtel"
    Left="3969"
    Top="1417"
    Width="1842"
    Height="284"
    Caption="dffgdgdgfgd"
    ClassName="Normal"
    Style="font-family: &apos;宋体&apos;; font-size: 12pt; color: rgb(0,0,255); "
    >
    </Control>
    </Section>
    <Section Type="PageFooter" Name="尾注"
    Height="0"
    >
    </Section>
    </Sections>
    </ActiveReportsLayout>就可以了。