📄 form_cjxt16.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form_CJXT16
Caption = "预览试卷"
ClientHeight = 9090
ClientLeft = 60
ClientTop = 345
ClientWidth = 13215
KeyPreview = -1 'True
LinkTopic = "Form1"
ScaleHeight = 9090
ScaleWidth = 13215
Begin VB.CommandButton Command1
Caption = "预览试卷"
Height = 645
Left = 10680
Picture = "Form_CJXT16.frx":0000
Style = 1 'Graphical
TabIndex = 5
Top = 450
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "上一步"
Height = 645
Left = 9360
Picture = "Form_CJXT16.frx":0184
Style = 1 'Graphical
TabIndex = 4
Top = 450
Width = 1035
End
Begin MSAdodcLib.Adodc Adodc1
Height = 345
Left = 6840
Top = 630
Visible = 0 'False
Width = 2145
_ExtentX = 3784
_ExtentY = 609
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=PAPER;Data Source=local"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=PAPER;Data Source=local"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "select ID,content,opA,opB,opC,opD from shijuan"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSComctlLib.ImageList ImageList1
Left = 870
Top = 60
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form_CJXT16.frx":0308
Key = "退出"
Object.Tag = "Exit"
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 420
Left = 0
TabIndex = 2
Top = 0
Width = 13215
_ExtentX = 23310
_ExtentY = 741
ButtonWidth = 1032
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 1
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "Exit"
Object.ToolTipText = "退出"
ImageIndex = 1
EndProperty
EndProperty
End
Begin VB.TextBox Text_Name
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 3360
TabIndex = 1
Top = 660
Width = 2205
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Form_CJXT16.frx":049C
Height = 7785
Left = 30
TabIndex = 3
Top = 1140
Width = 12795
_ExtentX = 22569
_ExtentY = 13732
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 23
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 6
BeginProperty Column00
DataField = "ID"
Caption = "编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "content"
Caption = "题目"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "opA"
Caption = "选项A"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "opB"
Caption = "选项B"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column04
DataField = "opC"
Caption = "选项C"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "opD"
Caption = "选项D"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1335.118
EndProperty
BeginProperty Column01
ColumnWidth = 4424.882
EndProperty
BeginProperty Column02
ColumnWidth = 1560.189
EndProperty
BeginProperty Column03
ColumnWidth = 1530.142
EndProperty
BeginProperty Column04
ColumnWidth = 1560.189
EndProperty
BeginProperty Column05
ColumnWidth = 1620.284
EndProperty
EndProperty
End
Begin VB.Label Label1
Caption = "请输入试卷名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 1470
TabIndex = 0
Top = 690
Width = 1845
End
End
Attribute VB_Name = "Form_CJXT16"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text_Name.Text = "" Then
ret = MsgBox("请输入试卷名:")
Else
Cmd.CommandType = adCmdText
Cmd.CommandText = "update shijuan set sjname='" & Text_Name & "',tag='0' where ID is not null and sjname is null"
Cmd.Execute
Cmd.CommandText = "select ID,content,opA,opB,opC,opD from shijuan where sjname='" & Text_Name & "'"
Cmd.Execute
Adodc1.Refresh
DataGrid1.Refresh
Dim wdapp As Word.Application
Dim wddoc As Word.Document
Dim atable As Word.Table
If Adodc1.Recordset.RecordCount > 0 Then
irecordcount = Adodc1.Recordset.RecordCount
Set wdapp = CreateObject("Word.Application")
Set wddoc = wdapp.Documents.Add
With wdapp
.Visible = True
.Activate
.Caption = "试卷"
Set atable = .ActiveDocument.Tables.Add(.Selection.Range, irecordcount + 1, 6)
' atable.Cell(1, 1).Range.InsertAfter "编号"
' atable.Cell(1, 2).Range.InsertAfter "题目"
' atable.Cell(1, 3).Range.InsertAfter "选项A"
' atable.Cell(1, 4).Range.InsertAfter "选项B"
' atable.Cell(1, 5).Range.InsertAfter "选项C"
' atable.Cell(1, 6).Range.InsertAfter "选项D"
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
atable.Cell(DataGrid1.Bookmark + 1, 1).Range.InsertAfter Adodc1.Recordset.Fields("ID")
atable.Cell(DataGrid1.Bookmark + 1, 2).Range.InsertAfter Adodc1.Recordset.Fields("Content")
If Adodc1.Recordset.Fields("opA") <> "" Then
atable.Cell(DataGrid1.Bookmark + 1, 3).Range.InsertAfter Adodc1.Recordset.Fields("opA")
End If
If Adodc1.Recordset.Fields("opB") <> "" Then
atable.Cell(DataGrid1.Bookmark + 1, 4).Range.InsertAfter Adodc1.Recordset.Fields("opB")
End If
If Adodc1.Recordset.Fields("opC") <> "" Then
atable.Cell(DataGrid1.Bookmark + 1, 5).Range.InsertAfter Adodc1.Recordset.Fields("opC")
End If
If Adodc1.Recordset.Fields("opD") <> "" Then
atable.Cell(DataGrid1.Bookmark + 1, 6).Range.InsertAfter Adodc1.Recordset.Fields("opD")
End If
Adodc1.Recordset.MoveNext
Loop
End With
Set wdapp = Nothing
Set wddoc = Nothing
End If
End If
End Sub
Private Sub Form_Load()
Height = 9800
Width = 13000
Left = 2400
Top = 1200
End Sub
Private Sub Command2_Click()
Form_CJXT16.Hide
Form_CJXT15.Show
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Exit"
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -