⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmoutputtype.frm

📁 大量优秀的vb编程
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmOutPut 
   Caption         =   "报表输出控制"
   ClientHeight    =   3168
   ClientLeft      =   60
   ClientTop       =   348
   ClientWidth     =   6396
   LinkTopic       =   "Form1"
   ScaleHeight     =   3168
   ScaleWidth      =   6396
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame frExport 
      Caption         =   "输出设置"
      Height          =   1575
      Left            =   1560
      TabIndex        =   10
      Top             =   1440
      Width           =   4695
      Begin VB.CheckBox chkExport 
         Caption         =   "显示输出对话框"
         Height          =   315
         Left            =   120
         TabIndex        =   14
         Top             =   360
         Width           =   2055
      End
      Begin VB.TextBox txtStartPageEx 
         Height          =   285
         Left            =   1080
         TabIndex        =   13
         Top             =   720
         Width           =   1215
      End
      Begin VB.TextBox txtPrintToEx 
         Height          =   285
         Left            =   3360
         TabIndex        =   12
         Top             =   720
         Width           =   1215
      End
      Begin VB.ComboBox cbExportType 
         Height          =   315
         Left            =   1080
         TabIndex        =   11
         Top             =   1080
         Width           =   3375
      End
      Begin VB.Label lbExportType 
         Caption         =   "输出文件类型"
         Height          =   372
         Left            =   240
         TabIndex        =   17
         Top             =   1080
         Width           =   612
      End
      Begin VB.Label lbStartPageEx 
         Caption         =   "开始页码:"
         Height          =   252
         Left            =   120
         TabIndex        =   16
         Top             =   720
         Width           =   972
      End
      Begin VB.Label lbPrintToEx 
         Caption         =   "结束页码:"
         Height          =   252
         Left            =   2520
         TabIndex        =   15
         Top             =   720
         Width           =   972
      End
   End
   Begin MSComDlg.CommonDialog CD 
      Left            =   5760
      Top             =   240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Frame frPrint 
      Caption         =   "打印设置"
      Height          =   1215
      Left            =   1560
      TabIndex        =   4
      Top             =   120
      Width           =   4695
      Begin VB.TextBox txtPrintTo 
         Height          =   285
         Left            =   3360
         TabIndex        =   9
         Top             =   720
         Width           =   1215
      End
      Begin VB.TextBox txtStartPage 
         Height          =   285
         Left            =   1080
         TabIndex        =   8
         Top             =   720
         Width           =   1332
      End
      Begin VB.CheckBox chkShowDialog 
         Caption         =   "显示打印对话框"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   1935
      End
      Begin VB.Label lbPrintTo 
         Caption         =   "结束页码:"
         Height          =   252
         Left            =   2520
         TabIndex        =   7
         Top             =   720
         Width           =   972
      End
      Begin VB.Label lbStart 
         Caption         =   "开始页码:"
         Height          =   252
         Left            =   120
         TabIndex        =   6
         Top             =   720
         Width           =   1092
      End
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出程序"
      Height          =   495
      Left            =   120
      TabIndex        =   3
      Top             =   2520
      Width           =   1215
   End
   Begin VB.CommandButton cmdExport 
      Caption         =   "输出报表"
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CommandButton cmdPrint 
      Caption         =   "打印报表"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton cmdPreview 
      Caption         =   "预览报表"
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   360
      Width           =   1215
   End
End
Attribute VB_Name = "frmOutPut"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub chkExpor_Click()

End Sub

Private Sub cmdExit_Click()
    End
End Sub

Private Sub cmdExport_Click()
    
    Dim Overwrite As Boolean
    
    If txtStartPageEx.Text <> "" Or txtPrintToEx.Text <> "" Then
        If IsNumeric(txtStartPageEx.Text) = False Or IsNumeric(txtPrintToEx.Text) = False Then
            MsgBox "The start or end pages to print is invalid.", 64
            Exit Sub
        End If
    End If
        
    CD.ShowSave
    If CD.FileName <> "" Then
        If Dir(CD.FileName) <> "" Then
            Ans% = MsgBox("Do you want to overwrite this file ?", vbQuestion Or vbYesNo)
            If Ans% = 6 Then
                Overwrite = True
            Else
                Overwrite = False
            End If
        Else
            Overwrite = False
        End If
        
        If txtStartPageEx.Text = "" And txtPrintToEx.Text = "" Then
            DataReport1.ExportReport DataReport1.ExportFormats(CLng(Left$(cbExportType.List(cbExportType.ListIndex), 1))).Key, CD.FileName, Overwrite, chkExport.Value * -1, rptRangeAllPages
        Else
            DataReport1.ExportReport DataReport1.ExportFormats(CLng(Left$(cbExportType.List(cbExportType.ListIndex), 1))).Key, CD.FileName, Overwrite, chkExport.Value * -1, txtStartPageEx.Text, txtPrintToEx.Text
        End If
    End If
        
End Sub

Private Sub cmdPreview_Click()
    'DataReport1.StartUpPosition = 2
    
    DataReport1.WindowState = 2
    DataReport1.Show
End Sub
 
Private Sub cmdPrint_Click()
    Dim fReturn As Long
    
    If txtStartPage.Text <> "" Or txtPrintTo.Text <> "" Then
        If IsNumeric(txtStartPage.Text) = False Or IsNumeric(txtPrintTo.Text) = False Then
            MsgBox "The start or end pages to print is invalid.", 64
            Exit Sub
        End If
    End If
    
    If txtStartPage.Text = "" And txtPrintTo.Text = "" Then
        fReturn = DataReport1.PrintReport(chkShowDialog.Value * -1, rptRangeAllPages)
    Else
        fReturn = DataReport1.PrintReport(chkShowDialog.Value * -1, txtStartPage.Text, txtPrintTo.Text)
    End If
    If fReturn = 2 Then
        MsgBox "Print Job Sent to Printer."
    Else
        MsgBox "Print Job Cancelled"
    End If
End Sub

Private Sub Form_Load()
    cbExportType.AddItem "1 - HTML"
    cbExportType.AddItem "2 - Text"
    cbExportType.AddItem "3 - Unicode HTML"
    cbExportType.AddItem "4 - Unicode Text"
    cbExportType.ListIndex = 0
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -