xxxhsn
xxxhsn
关注数: 10
粉丝数: 71
发帖数: 956
关注贴吧数: 12
2016级选考:For语句2_累加和累乘 解题思路: 1、通过循环由1循环到n 2、累加中1、2、3~n由循环生成,将每次循环中的i累加或累乘到s中 程序代码: Private Sub Command1_Click() '累加 Dim i As Integer, s As Long n = Val(Text1.Text): s = 0 For i = 1 To n s = s + i Next i Label1.Caption = Str(s) End Sub Private Sub Command2_Click() '累积 Dim i As Integer, s As Long n = Val(Text1.Text): s = 1 For i = 1 To n s = s * i Next i Label2.Caption = Str(s) End Sub 注:求和的是、初始值为0,求积s的初始值为1
2016级选考:For语句1_输出1-n的奇数 FOR语句的格式: For 变量=初值 to 终值 step 步长 循环语句Next变量 For i=1 to 10 step 1 循环语句Next i 解读: 1、循环语句中步长表示每次循环变量自动增加的量,step为1可以省略。 2、循环中for中变量要和next中的变量名称一致。 3、循环语句被执行的次数为(终值-初值+1)\步长 写法1: Private Sub Command1_Click() Dim i As Integer, n AsInteger, s As String n = Val(Text1.Text) s = "" For i = 1 To n If i Mod 2 = 1 Then s = s + Str(i) Next i Label1.Caption = s End Sub 写法2: For i =n To 1 step -1 If i Mod 2 = 1 Then s = Str(i)+s Next i 注:写法1和2,在于输出的次序s + Str(i)调整为Str(i)+s 写法3: For i = 1 To n step 2 s = s + Str(i) Next i For语句的误区: 1、写法3能不能写成: For i = 1 To n s = s + Str(i) i=i+1 Next i 程序虽然可以执行,但是我们要尽量避免,在for循环中,循环变量i在循环中可思议参加运算,但最好不要发改变。 2、下面语句能否执行: For i = 2 To 1 s = s +i Next i 程序虽然可以执行,并且不会报错。但是因为终值比初值大,所以循环不会被执行。 For i = 2 To 1 step -1 s = s +i Next i 添加上step -1 该循环就可以正常执行了。 3、循环退出后,变量i的值是多少:i>n For i=1 to n Next i 退出循环时候i的值为n+1
2016级选考:IF语句2_找出3个数中的最大数 写法1: Private Sub Command1_Click() Dim a As Integer, b AsInteger, c As Integer Dim max As Integer a =Val(Text1.Text): b = Val(Text2.Text) c = Val(Text3.Text) '找出最大的数给max If a > b Then max = a Elsemax = b If c > max Then max = c Label1.Caption = max End Sub 算法思路解读:找出a和b之间的最大值,然后将这个最大值和c比较 写法2: Max =a If b>max then max =b If c>max then max =c 算法思路解读:假设最大值max为a,如果b比max大,max就是b,如果c比max大,最大值就是c 写法3: If a > b And a >c Then max = a If b > a And b >c Then max = b If c > a And c >b Then max = c 算法思路解读:如果a比b和c都大,最大值就是a,如果b比a和c都大,最大值就是c,如果c比a和b都大,最大值就是c, 写法4: If a > b Then If a > cThen max = a Else max = c Else If b > cThen max = b Else max = c End If 算法思路解读:如果a比b大,考虑a和c的比较,否则考虑b和c的比较 IF隐藏的密码——执行效率 先来分析写法1,当程序执行完毕 如果最终a是最大值,需要经历 a>b max=a c>max 执行步骤3步 如果最终b是最大值,需要经历 a>b max=b c>max 执行步骤3步 如果最终c是最大值,需要经历 a>b max=a(或max=b) c>max max=c 执行步骤4步 写法1的最终执行效率是(3+3+4)/3=3.33 写法2的最终执行效率是(3+4+4.5)/3=3.83 写法3的最终执行效率是(10+10+10)/3=10 写法4的最终执行效率是(3+3+3)/3=3 从上我们看出执行效率最高的是方法4,书写最简单的是方法2
2016级选考:IF语句5_求解一元二次方程 Private Sub Command1_Click() Dim a As Integer, b AsInteger, c As Integer, d As Integer Dim x1 As Double, x2 AsDouble, s a = Val(Text1.Text): b= Val(Text2.Text): c = Val(Text3.Text) Label2.Caption ="" d = b * b - 4 * a * c If d < 0 Then Label1.Caption ="没有解" Else x1 = (-b + Sqr(d)) / (2 * a) x2 = (-b + Sqr(d)) / (2 * a) If d = 0 Then Label1.Caption ="两个相同的解" Label2.Caption ="x1=x2=" & Str(x1) Else Label1.Caption ="两个不同的解" Label2.Caption ="x1=" & Str(x1) & " x2=" & Str(x1) End If End If End Sub 注意公式和函数的使用 x1 = (-b + Sqr(d)) / (2 * a) x2 = (-b + Sqr(d)) / (2 * a)
2016级选考:IF语句4_排数的次序 比较的次序: ①找出4个数的最小值:a——b a——c a——d ②找出3个数的最小值:b——c b——d ③找出4个数的最小值:c——d Private Sub Command1_Click() Dim a As Integer, b AsInteger, c As Integer, d As Integer, t As Integer a = Val(Text1.Text): b= Val(Text2.Text) c = Val(Text3.Text): d= Val(Text4.Text) '确定a是4个数中最小 If a > b Then t = a:a = b: b = t If a > c Then t = a:a = c: c = t If a > d Then t = a:a = d: d = t '确定b是剩下3个数中最小 If b > c Then t = b:b = c: c = t If b > d Then t = b:b = d: d = t '确定c是剩下2个数中最小 If c > d Then t = c:c = d: d = t Label1.Caption = Str(a)+ Str(b) + Str(c) + Str(d) End Sub 比较的方法有很多种,注意比较的先后次序和逻辑性 IF 经典判断表达式:2 判断大写字母表达式: s>="A" and s<="Z" Asc(ch)>=asc("A") and Asc(ch)<=asc("Z") Asc(ch)>=65 and Asc(ch)<=90 判断小写字母表达式: s>="a" and s<="z" 判断字母表达式: s>="A" ands<="Z" or s>="a" and s<="z" 判断非字母表达式: not(s>="A" and s<="Z" ors>="a" and s<="z") (s<"A" or s>"Z") and (s<"a" ors>"z")
2016级选考:IF语句3_划分等地 x>=90 优秀 80<=x<90 良好 60<=x<80 及格 x<60 不及格 写法1:暴力写法 Private Sub Command1_Click() Dim x As Integer x = Val(Text1.Text) '判断x的成绩等地,输出到label1 If x >= 90 Then Label1.Caption = "优秀" If x >= 80 And x < 90 Then Label1.Caption = "良好" If x >= 60 And x < 80Then Label1.Caption = "及格" If x < 60 Then Label1.Caption = "不及格" End Sub 写法2:elseif 写法 If x >= 90 Then Label1.Caption ="优秀" ElseIf x >= 80 Then Label1.Caption ="良好" ElseIf x >= 60 Then Label1.Caption ="及格" Else Label1.Caption ="不及格" End If 写法3:if嵌套写法 If x >= 90 Then Label1.Caption ="优秀" Else If x >= 80 Then Label1.Caption ="良好" Else If x >= 60Then Label1.Caption= "及格" Else Label1.Caption= "不及格" End If End If End If 写法4:不同的切入点,会有不同的写法 If x >= 80 Then If x >= 90 Then Label1.Caption ="优秀" Else Label1.Caption ="良好" End If Else If x < 60 Then Label1.Caption ="不及格" Else Label1.Caption ="及格" End If End If 注意写法4的逻辑,切入点不同,写法会有很多,需要理清程序的逻辑。
2016级选考:IF语句2_找出3个数中的最大数 写法1: Private Sub Command1_Click() Dim a As Integer, b AsInteger, c As Integer Dim max As Integer a =Val(Text1.Text): b = Val(Text2.Text) c = Val(Text3.Text) '找出最大的数给max If a > b Then max = a Elsemax = b If c > max Then max = c Label1.Caption = max End Sub 算法思路解读:找出a和b之间的最大值,然后将这个最大值和c比较 写法2: Max =a If b>max then max =b If c>max then max =c 算法思路解读:假设最大值max为a,如果b比max大,max就是b,如果c比max大,最大值就是c 写法3: If a > b And a >c Then max = a If b > a And b >c Then max = b If c > a And c >b Then max = c 算法思路解读:如果a比b和c都大,最大值就是a,如果b比a和c都大,最大值就是c,如果c比a和b都大,最大值就是c, 写法4: If a > b Then If a > cThen max = a Else max = c Else If b > cThen max = b Else max = c End If 算法思路解读:如果a比b大,考虑a和c的比较,否则考虑b和c的比较 IF隐藏的密码——执行效率 先来分析写法1,当程序执行完毕 如果最终a是最大值,需要经历 a>b max=a c>max 执行步骤3步 如果最终b是最大值,需要经历 a>b max=b c>max 执行步骤3步 如果最终c是最大值,需要经历 a>b max=a(或max=b) c>max max=c 执行步骤4步 写法1的最终执行效率是(3+3+4)/3=3.33 写法2的最终执行效率是(3+4+4.5)/3=3.83 写法3的最终执行效率是(10+10+10)/3=10 写法3的最终执行效率是(3+3+3)/3=3 从上我们看出执行效率最高的是方法4
Excel自动批改系统_判分核心 Dim writtxt As StreamWriter Dim filename As String '阅卷文件 Dim studt As New System.Data.DataTable '需要阅卷文件列表 从sql中读取 Dim checkdt As New System.Data.DataTable '阅卷参数列表 从sql中读取 Dim index1 As Integer '文件列表序号 Dim index2 As Integer '阅卷参数列表序号 Dim flg As Boolean '阅卷标志 Dim resault As String = "" '阅卷结果 Dim dtexcel As New System.Data.DataTable '阅卷文件列表 Dim dtcheck As New System.Data.DataTable '阅卷标准列表 Dim strsql As SqlDataAdapter Dim strsql2 As OleDbDataAdapter Dim i As Integer Dim fileexit As Boolean = True '阅卷主程序 '阅卷的文件从数据库中读取需要阅卷的文件列表 Try dtexcel.Reset() cndata.Open() cmdSQL.CommandText = "SELECT course,courselistid,url,id,checknum FROM it_courseexcelstu where url <> '空' and flg2=0 and checknum <2" '设置阅卷测尝试次数为2次,超过两次没有阅卷通过 自动标记为过滤 ' 0 1 2 3 4 strsql = New SqlDataAdapter(cmdSQL.CommandText, cndata) strsql.Fill(dtexcel) Catch ex As Exception Finally cndata.Close() End Try If dtexcel.Rows.Count > 0 Then For index1 = 0 To dtexcel.Rows.Count - 1 resault = "" fileexit = True Try '内循环,该文件需要检测的阅卷项目 '阅卷参数从数据库中读取 Try dtcheck.Reset() cndataas.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" & Replace(System.Windows.Forms.Application.StartupPath, "chenbinexe", "uploadfile\tefile\course\") & dtexcel.Rows(index1).Item(0).ToString & "\" & dtexcel.Rows(index1).Item(1).ToString & ".mdb" & """;Persist Security Info=False" cmdSQLas.Connection = cndataas cndataas.Open() cmdSQLas.CommandText = "SELECT [list],[excel],[check1],[check2],[check3],[check4],[wc],[checkdata],[gx],[sm] FROM excelcheck ORDER BY list" ' 0 1 2 3 4 5 6 7 8 'checkdt.rows(index2).item(0) 阅卷点序号 checkdt.rows(index2).item(1) 阅卷数据库编号 checkdt.rows(index2).item(2~5) 阅卷定位参数 checkdt.rows(index2).item(6)误差 ,checkdt.rows(index2).item(7) 检测参数 checkdt.rows(index2).item(8)关系 strsql2 = New OleDbDataAdapter(cmdSQLas.CommandText, cndataas) strsql2.Fill(dtcheck) Catch ex As Exception Finally cndataas.Close() End Try If dtcheck.Rows.Count > 0 Then '避免空阅卷参数进入 '打开需要阅卷文件 Try '出错处理,避免某一文件出错,影响下一个文件阅卷 If File.Exists(Replace(System.Windows.Forms.Application.StartupPath, "chenbinexe", "uploadfile\stufile\course\" & dtexcel.Rows(index1).Item(0) & "\excel" & dtexcel.Rows(index1).Item(1) & "\") & dtexcel.Rows(index1).Item(2)) Then a = New Microsoft.Office.Interop.Excel.Application xls = a.Workbooks.Open(Replace(System.Windows.Forms.Application.StartupPath, "chenbinexe", "uploadfile\stufile\course\" & dtexcel.Rows(index1).Item(0) & "\excel" & dtexcel.Rows(index1).Item(1) & "\") & dtexcel.Rows(index1).Item(2)) sheet = xls.Worksheets(1) 'checkdt.rows(index2).item(0) 阅卷点序号 checkdt.rows(index2).item(1) 阅卷数据库编号 checkdt.rows(index2).item(2~5) 阅卷定位参数 checkdt.rows(index2).item(6)误差 ,checkdt.rows(index2).item(7) 检测参数 checkdt.rows(index2).item(8)关系 For index2 = 0 To dtcheck.Rows.Count - 1 flg = False Try '出错处理,避免某一个点出错,影响下面阅卷点 If dtcheck.Rows(index2).Item(1) = "001" Then flg = excel001(dtcheck.Rows(index2).Item(8), dtcheck.Rows(index2).Item(7)) '参数从数据库中来 If dtcheck.Rows(index2).Item(1) = "002" Then flg = excel002(dtcheck.Rows(index2).Item(8), dtcheck.Rows(index2).Item(7)) '掉用函数省略 Catch ex As Exception Finally End Try '记录阅卷结果 If flg Then resault = resault & "【第" & index2 + 1 & "阅卷点正确】" & dtcheck.Rows(index2).Item(9) & "正确" Else resault = resault & "【第" & index2 + 1 & "阅卷点错误】" & dtcheck.Rows(index2).Item(9) & "错误" End If Next xls.Save() xls.Close() End If Catch ex As Exception Finally Try a.Quit() Catch ex As Exception End Try End Try ' MsgBox("resault" & resault) '输出该文件的阅卷结果,ITtools3.0通过文本来对网站传递阅卷结果,由网页再次读取结果来分析统计,没有直接读写数据库的设计为了课程的打包考虑 If resault <> "" Then writtxt = New StreamWriter(Replace(Replace(System.Windows.Forms.Application.StartupPath, "chenbinexe", "uploadfile\stufile\course\" & dtexcel.Rows(index1).Item(0) & "\excel" & dtexcel.Rows(index1).Item(1) & "\") & dtexcel.Rows(index1).Item(2), ".xls", ".txt"), False, System.Text.Encoding.Default) writtxt.WriteLine(resault) writtxt.Close() End If End If
Excel自动批改系统_编号513,检测图表数据表 'Excel阅卷:编号513,检测图表数据表 Function excel513(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "显示" Then If xls.Sheets(i).HasDataTable = True Then flg = True End If Else If xls.Sheets(i).HasDataTable = False Then flg = True End If End If Else '非独立图表 If check2 = "显示" Then If xls.Sheets(i).ChartObjects(1).Chart.HasDataTable = True Then flg = True End If Else If xls.Sheets(i).ChartObjects(1).Chart.HasDataTable = False Then flg = True End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel513 = flg End Function
Excel自动批改系统_编号512,检测图表显示值显示 'Excel阅卷:编号512,检测图表显示值显示 Function excel512(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "显示" Then If xls.Sheets(i).SeriesCollection(1).DataLabels.ShowValue = False Then flg = True End If Else Try If xls.Sheets(i).SeriesCollection(1).DataLabels.ShowValue = False Then flg = False End If Catch ex As Exception flg = True End Try End If Else '非独立图表 If check2 = "显示" Then If xls.Sheets(i).ChartObjects(1).Chart.SeriesCollection(1).DataLabels.ShowValue = False Then flg = True End If Else '该项目无法直接获取,用出错处理代替获取 Try If xls.Sheets(i).ChartObjects(1).Chart.SeriesCollection(1).DataLabels.ShowValue = False Then flg = False End If Catch ex As Exception flg = True End Try '补充检测,是否无图表 If xls.Sheets(i).ChartObjects.count < 1 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel512 = flg End Function
Excel自动批改系统_编号511,检测图表位置 'Excel阅卷:编号511,检测图表位置 Function excel511(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal check3 As String, ByVal wc As String) As Boolean ' 关系 工作表名 左上单元格 右下单元格 误差 Dim i As Integer Dim flg As Boolean = False Dim top11 As Double Dim top12 As Double Dim top13 As Double Dim top14 As Double Dim high1 As Double Dim widh1 As Double Dim top21 As Double Dim top22 As Double Dim top23 As Double Dim top24 As Double Dim high2 As Double Dim widh2 As Double Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 flg = False Else '非独立图表 top11 = xls.Sheets(i).range(check2).Top top12 = xls.Sheets(i).range(check2).Left top13 = xls.Sheets(i).range(check3).Offset(1, 1).Top top14 = xls.Sheets(i).range(check3).Offset(1, 1).Left high1 = top13 - top11 widh1 = top14 - top12 top21 = xls.Sheets(i).ChartObjects(1).Top top22 = xls.Sheets(i).ChartObjects(1).Left high2 = xls.Sheets(i).ChartObjects(1).Height widh2 = xls.Sheets(i).ChartObjects(1).Width If Abs(top21 - top11) > wc Or Abs(top22 - top12) > wc Or Abs(high2 - high1) > wc Or Abs(widh2 - widh1) > wc Then Else flg = True End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel511 = flg End Function
Excel自动批改系统_编号510,检测图表图例显示 'Excel阅卷:编号510,检测图表图例显示 Function excel510(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "显示" Then If xls.Sheets(i).HasLegend = True Then flg = True End If Else If xls.Sheets(i).HasLegend = False Then flg = True End If End If Else '非独立图表 If check2 = "显示" Then If xls.Sheets(i).ChartObjects(1).Chart.HasLegend = True Then flg = True End If Else If xls.Sheets(i).ChartObjects(1).Chart.HasLegend = False Then flg = True End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel510 = flg End Function
Excel自动批改系统_编号509,检测图表字体颜色 'Excel阅卷:编号509,检测图表字体颜色 Function excel509(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "x" Then t = xls.Sheets(i).Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.ColorIndex t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.ColorIndex t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).Chart.ChartTitle.Characters.Font.ColorIndex t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If Else '非独立图表 If check2 = "x" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.ColorIndex t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.ColorIndex t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).ChartObjects(1).Chart.ChartTitle.Characters.Font.ColorIndex t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel509 = flg End Function
Excel自动批改系统_编号508,检测图表字号 'Excel阅卷:编号508,检测图表字号 Function excel508(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "x" Then t = xls.Sheets(i).Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.Size t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.Size t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).Chart.ChartTitle.Characters.Font.Size t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If Else '非独立图表 If check2 = "x" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.Size t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.Size t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).ChartObjects(1).Chart.ChartTitle.Characters.Font.Size t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel508 = flg End Function
Excel自动批改系统_编号507,检测图表字形 'Excel阅卷:编号507,检测图表字形 Function excel507(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "x" Then t = xls.Sheets(i).Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.FontStyle t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.FontStyle t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).Chart.ChartTitle.Characters.Font.FontStyle t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If Else '非独立图表 If check2 = "x" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.FontStyle t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.FontStyle t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).ChartObjects(1).Chart.ChartTitle.Characters.Font.FontStyle t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel507 = flg End Function
Excel自动批改系统_编号506,检测图表字体 'Excel阅卷:编号506,检测图表字体 Function excel506(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 对象 图表或坐标轴 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try check2 = Replace(check2.ToLower, " ", "") checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "x" Then t = xls.Sheets(i).Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.name t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.name t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).ChartTitle.Characters.Font.name t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If Else '非独立图表 If check2 = "x" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.name t = Replace(t.ToLower, " ", "") End If If check2 = "y" Then t = xls.Sheets(i).ChartObjects(1).Chart.Axes(XlAxisType.xlValue, XlAxisGroup.xlPrimary).AxisTitle.Characters.Font.name t = Replace(t.ToLower, " ", "") End If If check2 = "标题" Then t = xls.Sheets(i).ChartObjects(1).Chart.ChartTitle.Characters.Font.name t = Replace(t.ToLower, " ", "") End If If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel506 = flg End Function
Excel自动批改系统_编号504,检测图表标题 'Excel阅卷:编号504,检测图表标题 Function excel504(ByVal gx As String, ByVal check1 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try checkdata = Replace(checkdata.ToLower, " ", "") For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 t = xls.Sheets(i).ChartTitle.Characters.Text t = Replace(t.ToLower, " ", "") If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") < 1 Then flg = True End If End If If gx = "包含" Then If InStr(t, checkdata) > 0 Then flg = True End If End If If gx = "不包含" Then If InStr(t, checkdata) < 1 Then flg = True End If End If Else '非独立图表 t = xls.Sheets(i).ChartObjects(1).Chart.ChartTitle.Characters.Text t = Replace(t.ToLower, " ", "") If gx = "等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") > 0 Then flg = True End If End If If gx = "不等于" Then If InStr("|" & checkdata & "|", "|" & t & "|") < 1 Then flg = True End If End If If gx = "包含" Then If InStr(t, checkdata) > 0 Then flg = True End If End If If gx = "不包含" Then If InStr(t, checkdata) < 1 Then flg = True End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel504 = flg End Function
Excel自动批改系统_编号503,检测图表系列 'Excel阅卷:编号503,检测图表系列 Function excel503(ByVal gx As String, ByVal check1 As String, ByVal check2 As String) As Boolean ' 关系 工作表名 系列 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If check2 = "列" Then If xls.Sheets(i).PlotBy = 2 Then flg = True Else flg = False End If Else If xls.Sheets(i).PlotBy = 2 Then flg = False Else flg = True End If End If Else '非独立图表 If check2 = "列" Then If xls.Sheets(i).ChartObjects(1).Chart.PlotBy = 2 Then flg = True Else flg = False End If Else If xls.Sheets(i).ChartObjects(1).Chart.PlotBy = 2 Then flg = False Else flg = True End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel503 = flg End Function
Excel自动批改系统_编号502,检测图表源数据 'Excel阅卷:编号502,检测图表源数据 Function excel502(ByVal gx As String, ByVal check1 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 检测值 Dim i As Integer Dim flg As Boolean = False Dim t As String Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 t = Replace(xls.Sheets(i).SeriesCollection(1).Formula.ToString.ToLower, " ", "") t = Replace(Replace(Mid(t, 8, Len(t) - 7), " ", ""), "$", "") If gx = "是" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & t & "|") > 0 Then flg = True End If Else flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & t & "|") > 0 Then flg = False End If End If Else '非独立图表 t = Replace(xls.Sheets(i).ChartObjects(1).Chart.SeriesCollection(1).Formula.ToString.ToLower, " ", "") t = Replace(Replace(Mid(t, 8, Len(t) - 7), " ", ""), "$", "") If gx = "是" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & t & "|") > 0 Then flg = True End If Else flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & t & "|") > 0 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel502 = flg End Function
Excel自动批改系统_编号501,检测图表类型 'Excel阅卷:编号501,检测图表类型 Function excel501(ByVal gx As String, ByVal check1 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 检测值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).type.ToString.ToLower <> -4167 Then '独立图表 If gx = "是" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).ChartType.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If Else flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).ChartType.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Else '非独立图表 If gx = "是" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).ChartObjects(1).Chart.ChartType.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If Else flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).ChartObjects(1).Chart.ChartType.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel501 = flg End Function
Excel自动批改系统_编号405,列隐藏检测 'Excel阅卷:编号405,列隐藏检测 Function excel405(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal check3 As String) As Boolean ' 关系 工作表名 显示行号 隐藏行号 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If xls.Sheets(i).Range(check2).EntireRow.Hidden = False And xls.Sheets(i).Range(check3).EntireRow.Hidden = True Then flg = True End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel405 = flg End Function
Excel自动批改系统_编号404,列隐藏检测 'Excel阅卷:编号404,列隐藏检测 Function excel404(ByVal gx As String, ByVal check1 As String, ByVal check2 As String) As Boolean ' 关系 工作表名 行号 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "是" Then If xls.Sheets(i).Range(check2).EntireColumn.Hidden = True Then flg = True End If End If If gx = "不是" Then flg = True If xls.Sheets(i).Range(check2).EntireColumn.Hidden = True Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel404 = flg End Function
Excel自动批改系统_编号403,行高检测 'Excel阅卷:编号403,行高检测 Function excel403(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String, ByVal wc As Double) As Boolean ' 关系 工作表名 行号 检测数值 误差 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If Abs(checkdata - xls.Sheets(i).Range(check2).ColumnWidth) <= wc Then flg = True End If End If If gx = "不等于" Then If Abs(checkdata - xls.Sheets(i).Range(check2).ColumnWidth) > wc Then flg = True End If End If If gx = "大于" Then If xls.Sheets(i).Range(check2).ColumnWidth - checkdata > 0 Then flg = True End If End If If gx = "小于" Then If xls.Sheets(i).Range(check2).ColumnWidth - checkdata > 0 < 0 Then flg = True End If End If If gx = "大于等于" Then If xls.Sheets(i).Range(check2).ColumnWidth - checkdata >= 0 Then flg = True End If End If If gx = "小于等于" Then If xls.Sheets(i).Range(check2).ColumnWidth - checkdata > 0 <= 0 Then flg = True End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel403 = flg End Function
Excel自动批改系统_编号402,行隐藏检测(用于自动筛选检测) 'Excel阅卷:编号402,行隐藏检测 Function excel402(ByVal gx As String, ByVal check1 As String, ByVal check2 As String) As Boolean ' 关系 工作表名 行号 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "是" Then If xls.Sheets(i).Range(check2).EntireRow.Hidden = True Then flg = True End If End If If gx = "不是" Then flg = True If xls.Sheets(i).Range(check2).EntireRow.Hidden = True Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel402 = flg End Function
Excel自动批改系统_编号401,行高检测 'Excel阅卷:编号401,行高检测 Function excel401(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String, ByVal wc As Double) As Boolean ' 关系 工作表名 行号 检测数值 误差 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If Abs(checkdata - xls.Sheets(i).Range(check2).RowHeight) <= wc Then flg = True End If End If If gx = "不等于" Then If Abs(checkdata - xls.Sheets(i).Range(check2).RowHeight) > wc Then flg = True End If End If If gx = "大于" Then If xls.Sheets(i).Range(check2).RowHeight - checkdata > 0 Then flg = True End If End If If gx = "小于" Then If xls.Sheets(i).Range(check2).RowHeight - checkdata > 0 < 0 Then flg = True End If End If If gx = "大于等于" Then If xls.Sheets(i).Range(check2).RowHeight - checkdata >= 0 Then flg = True End If End If If gx = "小于等于" Then If xls.Sheets(i).Range(check2).RowHeight - checkdata > 0 <= 0 Then flg = True End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel401 = flg End Function
Excel自动批改系统_编号313,区域单元格排序 'Excel阅卷:编号313,区域单元格排序 Function excel313(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal check3 As String, ByVal check4 As String) As Boolean ' 关系 工作表名 采样点1 采样点2 采样点3 Dim i As Integer Dim j As Integer Dim flg As Boolean = False Dim chkrng As String '单元格名 Dim num As String ' 辅助检测数值 懒得改变量名了 Dim dtype As String '数据类型 Dim check As String 'check = check2 'check = Replace(check, " ", "") 'chkrng = Mid(check, 1, InStr(check, "|") - 1) 'check = Mid(check, InStr(check, "|") + 1, Len(check)) 'num = CInt(Mid(check, 1, InStr(check, "|") - 1)) 'dtype = Mid(check, InStr(check, "|") + 1, Len(check)) Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then check = check2 check = Replace(check, " ", "") chkrng = Mid(check, 1, InStr(check, "|") - 1) check = Mid(check, InStr(check, "|") + 1, Len(check)) num = Mid(check, 1, InStr(check, "|") - 1) dtype = Mid(check, InStr(check, "|") + 1, Len(check)) '根据数文进行不同检测 flg = True If dtype = "数" Then If Abs(xls.Sheets(i).Range(chkrng).text - num) > 0.01 Then flg = False End If Else If Replace(xls.Sheets(i).Range(chkrng).text.ToString.ToLower, " ", "") <> Replace(num.ToLower, " ", "") Then flg = False End If End If check = check3 check = Replace(check, " ", "") chkrng = Mid(check, 1, InStr(check, "|") - 1) check = Mid(check, InStr(check, "|") + 1, Len(check)) num = Mid(check, 1, InStr(check, "|") - 1) dtype = Mid(check, InStr(check, "|") + 1, Len(check)) '根据数文进行不同检测 flg = True If dtype = "数" Then If Abs(xls.Sheets(i).Range(chkrng).text - num) > 0.01 Then flg = False End If Else If Replace(xls.Sheets(i).Range(chkrng).text.ToString.ToLower, " ", "") <> Replace(num.ToLower, " ", "") Then flg = False End If End If check = check4 check = Replace(check, " ", "") chkrng = Mid(check, 1, InStr(check, "|") - 1) check = Mid(check, InStr(check, "|") + 1, Len(check)) num = Mid(check, 1, InStr(check, "|") - 1) dtype = Mid(check, InStr(check, "|") + 1, Len(check)) '根据数文进行不同检测 flg = True If dtype = "数" Then If Abs(xls.Sheets(i).Range(chkrng).text - num) > 0.01 Then flg = False End If Else If Replace(xls.Sheets(i).Range(chkrng).text.ToString.ToLower, " ", "") <> Replace(num.ToLower, " ", "") Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel313 = flg End Function
Excel自动批改系统_编号312,区域单元格排序 'Excel阅卷:编号312,区域单元格排序 Function excel312(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal check3 As String, ByVal check4 As String) As Boolean ' 关系 工作表名 排序区域 排序方式 辅助检测数值 Dim i As Integer Dim j As Integer Dim flg As Boolean = False Dim chkrng1 As String '单元格名 Dim num As Integer ' 检测数目 Dim chkrng2 As String '辅助检测单元格名 Dim chkrng3 As String '辅助检测数值 Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then check2 = Replace(check2, " ", "") chkrng1 = Mid(check2, 1, InStr(check2, "|") - 1) num = CInt(Mid(check2, InStr(check2, "|") + 1, Len(check2))) check4 = Replace(check4, " ", "") chkrng2 = Mid(check4, 1, InStr(check4, "|") - 1) chkrng3 = Mid(check4, InStr(check4, "|") + 1, Len(check4)) If check3 = "升序" Then Try flg = True For j = 1 To num - 1 If xls.Sheets(i).Range(chkrng1).Offset(j).text < xls.Sheets(i).Range(chkrng1).Offset(j - 1).text Then flg = False End If Next If Replace(xls.Sheets(i).Range(chkrng2).text.ToString.ToLower, " ", "") <> Replace(chkrng3.ToLower, " ", "") Then flg = False End If Catch ex As Exception flg = False End Try Else '降序处理 Try flg = True For j = 1 To num - 1 If xls.Sheets(i).Range(chkrng1).Offset(j).text > xls.Sheets(i).Range(chkrng1).Offset(j - 1).text Then flg = False End If Next If Replace(xls.Sheets(i).Range(chkrng2).text.ToString.ToLower, " ", "") <> Replace(chkrng3.ToLower, " ", "") Then flg = False End If Catch ex As Exception flg = False End Try End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel312 = flg End Function
Excel自动批改系统_编号311,区域单元格是否合并 'Excel阅卷:编号311,区域单元格是否合并 Function excel311(ByVal gx As String, ByVal check1 As String, ByVal check2 As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "是" Then If xls.Sheets(i).Range(check2).MergeCells = True Then flg = True End If End If If gx = "不是" Then flg = True If xls.Sheets(i).Range(check2).MergeCells = True Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel311 = flg End Function
Excel自动批改系统_编号308,区域单元格垂直对齐方式 'Excel阅卷:编号308,区域单元格垂直对齐方式 Function excel308(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False '靠左、居中、靠右、两端对齐、跨列居中 If checkdata = "靠上" Then checkdata = "4160" If checkdata = "居中" Then checkdata = "-4108" If checkdata = "靠下" Then checkdata = "-4107" Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).VerticalAlignment.ToString.ToLower Then flg = True End If End If If gx = "不等于" Then flg = True If checkdata.ToLower = xls.Sheets(i).Range(check2).VerticalAlignment.ToString.ToLower Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel308 = flg End Function
Excel自动批改系统_编号307,区域单元格水平对齐方式 'Excel阅卷:编号307,区域单元格水平对齐方式 Function excel307(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False '靠左、居中、靠右、两端对齐、跨列居中 If checkdata = "常规" Then checkdata = "1" If checkdata = "靠左" Then checkdata = "-4131" If checkdata = "居中" Then checkdata = "-4108" If checkdata = "靠右" Then checkdata = "-4152" If checkdata = "两端对齐" Then checkdata = "-4130" If checkdata = "跨列居中" Then checkdata = "7" Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).HorizontalAlignment.ToString.ToLower Then flg = True End If End If If gx = "不等于" Then flg = True If checkdata.ToLower = xls.Sheets(i).Range(check2).HorizontalAlignment.ToString.ToLower Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel307 = flg End Function
Excel自动批改系统_编号306,区域单元格格式背景颜色 'Excel阅卷:编号306,区域单元格格式背景颜色 Function excel306(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Interior.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Interior.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel306 = flg End Function
Excel自动批改系统_编号305,区域单元格格式字体颜色 'Excel阅卷:编号305,区域单元格格式字体颜色 Function excel305(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel305 = flg End Function
Excel自动批改系统_编号304,区域单元格格式字号 'Excel阅卷:编号304,区域单元格格式字号 Function excel304(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Size.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Size.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel304 = flg End Function
Excel自动批改系统_编号303,区域单元格格式字形 'Excel阅卷:编号303,区域单元格格式字形 Function excel303(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.FontStyle.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.FontStyle.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel303 = flg End Function
Excel自动批改系统_编号302,区域单元格格式字体 'Excel阅卷:编号302,区域单元格格式字体 Function excel302(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Name.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Name.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel302 = flg End Function
Excel自动批改系统_编号301,区域单元格格式数字格式,文字 'Excel阅卷:编号301,区域单元格格式数字格式,文字 Function excel301(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 区域单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If If gx = "包含" Then If InStr(Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", ""), Replace(checkdata.ToLower, " ", "")) > 0 Then flg = True End If End If If gx = "不包含" Then flg = True If InStr(Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", ""), Replace(checkdata.ToLower, " ", "")) > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel301 = flg End Function
2016级技术选考:IF语句1_判断奇偶 Private Sub Command1_Click() Dim x As Integer, s AsString x = Val(Text1.Text) If x Mod 2 = 0 Then s = "偶数" Else s = "奇数" End If Label1.Caption = s End Sub IF语句是VB编程的基础。 1、IF语句的结构,分为单分支结构和双分支结构 If 条件 then 执行语句1 Else 执行语句2 End if If 条件 then 执行语句 Endif 双分支结构 单分支结构 2、IF语句的书写方式,分为行语句模式和块语句模式 双分支行语句模式 If 条件 then 执行语句1 else执行语句2 单分支行语句模式 If 条件 then 执行语句 和块语句相比,行语句没有END IF 3、IF语句的条件 用于判断x是偶数的表达式是 x Mod 2 =0,我们还可以使用以下的表达式达到同样的效果 not x mod 2=1 x/2 =int(x/2) x/2 =x\2 (x+1) mod 2 =1 当然,我们在答题的时候会选中第一个答案x Mod 2 = 0,也就是最正常的答案。 4、IF语句的写法 If x Mod 2 = 0 Then s = "偶数" Else s = "奇数" End If If x Mod 2 = 1 Then s = "奇数" Else s = "偶数" End If s = "奇数" If x Mod 2 = 0 Then s = "偶数" End If s = "偶数" If x Mod 2 = 1 Then s = "奇数" End If
2016级技术选考:Rnd函数的秘密 当时定义rnd()函数的开发者,绝对是牛人一枚。 rnd函数的取值范围是[0,1)。0是包含,1不包含。期中()平时可以省略,考试时候要规范。 所以当rnd*91,我们就得到了[0,91)的随机数。 int(rnd*91)就得到了[0,90]的随机整数。 int(rnd+91)+10 就得到了[10,100]的随机整数。 我们把上面的过程进行逆推,我们就可以得到用rnd来生成[a,b]之间的随机整数的公式:int(rnd*(b-a+1))+a 看完上面,也许你以为rnd就是这样,那么请接着看下面的问题: int(rnd)=0 rnd*rnd 的取值范围是多少? [0,1) 1-rnd 的取值范围是多少? (0,1] rnd-rnd 的取值范围又是多少?(-1,1) rnd-rnd+1的取值范围又是多少呢? (0,2) 有没有突然间打开了新的思路! (rnd-rnd+1)/2 就得到了(0,1)之间的随机数。 好了,现在你能告诉我: 1. 生成[65,90]之间的随机整数的表达式是_____ 2. 生成(a,b)之间的随机数的表达式是_____
这个贴吧好多年没有吧主了。我准备去竞选吧主 这个贴吧好多年没有吧主了。我准备去竞选吧主
这么多年贴吧多没有吧主,最近几年的吧主在哪里? 这么多年贴吧多没有吧主,最近几年的吧主在哪里?
Excel自动批改系统_编号212,单元格边框线形 'Excel阅卷:编号212,单元格边框线形 Function excel212(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal check3 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 方向 检测数值 Dim i As Integer Dim flg As Boolean = False Dim checkdata2 As String = "0" '靠左、居中、靠右、两端对齐、跨列居中 If checkdata = "细线" Then checkdata2 = "2" checkdata = "1" End If If checkdata = "粗线" Then checkdata2 = "4" checkdata = "1" End If If checkdata = "双实线" Then checkdata2 = "4" checkdata = "-4119" End If Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If check3 = "上" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).Weight.ToString.ToLower Then flg = True End If End If If check3 = "下" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).Weight.ToString.ToLower Then flg = True End If End If If check3 = "左" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).Weight.ToString.ToLower Then flg = True End If End If If check3 = "右" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).Weight.ToString.ToLower Then flg = True End If End If If check3 = "\" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalDown).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalDown).Weight.ToString.ToLower Then flg = True End If End If If check3 = "/" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalUp).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalUp).Weight.ToString.ToLower Then flg = True End If End If
Excel自动批改系统_编号212,单元格边框线形 'Excel阅卷:编号212,单元格边框线形 Function excel212(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal check3 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 方向 检测数值 Dim i As Integer Dim flg As Boolean = False Dim checkdata2 As String = "0" '靠左、居中、靠右、两端对齐、跨列居中 If checkdata = "细线" Then checkdata2 = "2" checkdata = "1" End If If checkdata = "粗线" Then checkdata2 = "4" checkdata = "1" End If If checkdata = "双实线" Then checkdata2 = "4" checkdata = "-4119" End If Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If check3 = "上" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).Weight.ToString.ToLower Then flg = True End If End If If check3 = "下" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).Weight.ToString.ToLower Then flg = True End If End If If check3 = "左" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).Weight.ToString.ToLower Then flg = True End If End If If check3 = "右" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).Weight.ToString.ToLower Then flg = True End If End If If check3 = "\" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalDown).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalDown).Weight.ToString.ToLower Then flg = True End If End If If check3 = "/" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalUp).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalUp).Weight.ToString.ToLower Then flg = True End If End If If check3 = "四周" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).Weight.ToString.ToLower And checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).Weight.ToString.ToLower And checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).Weight.ToString.ToLower And checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).Weight.ToString.ToLower Then flg = True End If End If End If If gx = "不等于" Then flg = True If check3 = "上" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).Weight.ToString.ToLower Then flg = False End If End If If check3 = "下" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).Weight.ToString.ToLower Then flg = False End If End If If check3 = "左" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).Weight.ToString.ToLower Then flg = False End If End If If check3 = "右" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).Weight.ToString.ToLower Then flg = False End If End If If check3 = "\" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalDown).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalDown).Weight.ToString.ToLower Then flg = False End If End If If check3 = "/" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalUp).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlDiagonalUp).Weight.ToString.ToLower Then flg = False End If End If If check3 = "四周" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeTop).Weight.ToString.ToLower And checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeBottom).Weight.ToString.ToLower And checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeLeft).Weight.ToString.ToLower And checkdata.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).LineStyle.ToString.ToLower And checkdata2.ToLower = xls.Sheets(i).Range(check2).Borders(XlBordersIndex.xlEdgeRight).Weight.ToString.ToLower Then flg = False End If End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel212 = flg End Function
Excel自动批改系统_编号211,单元格垂直对齐方式 'Excel阅卷:编号211,单元格垂直对齐方式 Function excel211(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False '靠左、居中、靠右、两端对齐、跨列居中 If checkdata = "靠上" Then checkdata = "4160" If checkdata = "居中" Then checkdata = "-4108" If checkdata = "靠下" Then checkdata = "-4107" Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).VerticalAlignment.ToString.ToLower Then flg = True End If End If If gx = "不等于" Then flg = True If checkdata.ToLower = xls.Sheets(i).Range(check2).VerticalAlignment.ToString.ToLower Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel211 = flg End Function
Excel自动批改系统_编号210,单元格水平对齐方式 'Excel阅卷:编号210,单元格水平对齐方式 Function excel210(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False '靠左、居中、靠右、两端对齐、跨列居中 If checkdata = "常规" Then checkdata = "1" If checkdata = "靠左" Then checkdata = "-4131" If checkdata = "居中" Then checkdata = "-4108" If checkdata = "靠右" Then checkdata = "-4152" If checkdata = "两端对齐" Then checkdata = "-4130" If checkdata = "跨列居中" Then checkdata = "7" Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If checkdata.ToLower = xls.Sheets(i).Range(check2).HorizontalAlignment.ToString.ToLower Then flg = True End If End If If gx = "不等于" Then flg = True If checkdata.ToLower = xls.Sheets(i).Range(check2).HorizontalAlignment.ToString.ToLower Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel210 = flg End Function
Excel自动批改系统_编号209,单元格格式背景颜色 'Excel阅卷:编号209,单元格格式背景颜色 Function excel209(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Interior.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Interior.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel209 = flg End Function
Excel自动批改系统_编号208,单元格格式字体颜色 'Excel阅卷:编号208,单元格格式字体颜色 Function excel208(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.ColorIndex.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel208 = flg End Function
Excel自动批改系统_编号207,单元格格式字号 'Excel阅卷:编号207,单元格格式字号 Function excel207(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Size.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Size.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel207 = flg End Function
Excel自动批改系统_编号206,单元格格式字形 'Excel阅卷:编号206,单元格格式字形 Function excel206(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.FontStyle.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.FontStyle.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel206 = flg End Function
Excel自动批改系统_编号205,单元格格式字体 'Excel阅卷:编号205,单元格格式字体 Function excel205(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Name.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Font.Name.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception Finally End Try excel205 = flg End Function
Excel自动批改系统_编号204,单元格格式数字格式 'Excel阅卷:编号204,单元格格式数字格式,文字 Function excel204(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If If gx = "包含" Then If InStr(Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", ""), Replace(checkdata.ToLower, " ", "")) > 0 Then flg = True End If End If If gx = "不包含" Then flg = True If InStr(Replace(xls.Sheets(i).Range(check2).NumberFormatLocal.ToString.ToLower, " ", ""), Replace(checkdata.ToLower, " ", "")) > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel204 = flg End Function
Excel自动批改系统_编号203,单元格公式检测 'Excel阅卷:编号203,单元格公式检测,文字 Function excel203(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Formula.ToString.ToLower, " ", "") & "|") > 0 Then flg = True End If End If If gx = "不等于" Then flg = True If InStr("|" & Replace(checkdata.ToLower, " ", "") & "|", "|" & Replace(xls.Sheets(i).Range(check2).Formula.ToString.ToLower, " ", "") & "|") > 0 Then flg = False End If End If If gx = "包含" Then If InStr(Replace(xls.Sheets(i).Range(check2).Formula.ToString.ToLower, " ", ""), Replace(checkdata.ToLower, " ", "")) > 0 Then flg = True End If End If If gx = "不包含" Then flg = True If InStr(Replace(xls.Sheets(i).Range(check2).Formula.ToString.ToLower, " ", ""), Replace(checkdata.ToLower, " ", "")) > 0 Then flg = False End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel203 = flg End Function
Excel自动批改系统_编号202,单元格内容检测,数值 'Excel阅卷:编号202,单元格内容检测,数值 Function excel202(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String, ByVal wc As Double) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If Abs(checkdata - xls.Sheets(i).Range(check2).Text) <= wc Then flg = True End If End If If gx = "不等于" Then If Abs(checkdata - xls.Sheets(i).Range(check2).Text) > wc Then flg = True End If End If If gx = "大于" Then If xls.Sheets(i).Range(check2).Text - checkdata > 0 Then flg = True End If End If If gx = "小于" Then If xls.Sheets(i).Range(check2).Text - checkdata > 0 < 0 Then flg = True End If End If If gx = "大于等于" Then If xls.Sheets(i).Range(check2).Text - checkdata >= 0 Then flg = True End If End If If gx = "小于等于" Then If xls.Sheets(i).Range(check2).Text - checkdata > 0 <= 0 Then flg = True End If End If Exit For End If Next Catch ex As Exception flg = False Finally End Try excel202 = flg End Function
Excel自动批改系统_编号201,单元格内容检测,文字 'Excel阅卷:编号201,单元格内容检测,文字 Function excel201(ByVal gx As String, ByVal check1 As String, ByVal check2 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 单元格名 检测数值 Dim i As Integer Dim flg As Boolean = False Try For i = 1 To xls.Sheets.Count If check1.ToLower = xls.Sheets(i).name.ToString.ToLower Then If gx = "等于" Then If Trim(checkdata.ToLower) = Trim(xls.Sheets(i).Range(check2).Text.ToString) Then flg = True End If If gx = "不等于" Then If Trim(checkdata.ToLower) <> Trim(xls.Sheets(i).Range(check2).Text.ToString) Then flg = True End If If gx = "包含" Then If InStr(Trim(xls.Sheets(i).Range(check2).Text.ToString.ToLower), Trim(checkdata.ToLower)) > 0 Then flg = True End If If gx = "不包含" Then If InStr(Trim(xls.Sheets(i).Range(check2).Text.ToString.ToLower), Trim(checkdata.ToLower)) < 1 Then flg = True End If End If Next Catch ex As Exception flg = False Finally End Try excel201 = flg End Function
Excel自动批改系统_编号103,检测工作表次序 'Excel阅卷:编号103,检测工作表次序 Function excel103(ByVal gx As String, ByVal check1 As String, ByVal check2 As String) As Boolean ' 关系 工作表名1(前) 工作表名2(后) Dim i As Integer Dim flg As Boolean = False Dim num1 As Integer = 0 Dim num2 As Integer = 0 Try For i = 1 To xls.Sheets.Count If xls.Sheets(i).name.ToString.ToLower = check1.ToLower Then num1 = i If xls.Sheets(i).name.ToString.ToLower = check2.ToLower Then num2 = i Next Catch ex As Exception Finally End Try If gx = "是" Then If num1 <> 0 And num2 <> 0 And num2 > num1 Then flg = True Else flg = True If num1 <> 0 And num2 <> 0 And num2 > num1 Then flg = False End If excel103 = flg End Function
Excel自动批改系统_编号102,检测工作表类型 'Excel 工作表类型type返回值说明 -4167 工作表 3 图表 Function excel102(ByVal gx As String, ByVal check1 As String, ByVal checkdata As String) As Boolean ' 关系 工作表名 类型参数 Dim i As Integer Dim flg As Boolean = False Try If gx = "等于" Then For i = 1 To xls.Sheets.Count If xls.Sheets(i).name.ToString.ToLower = check1.ToLower Then If xls.Sheets(i).type.ToString = checkdata Then flg = True End If End If Next Else flg = True For i = 1 To xls.Sheets.Count If xls.Sheets(i).name.ToString.ToLower = check1.ToLower Then If xls.Sheets(i).type.ToString = checkdata Then flg = False End If End If Next End If Catch ex As Exception flg = False Finally End Try excel102 = flg End Function
Excel自动批改系统_编号101,检测工作表是否存在 'Excel阅卷:编号101,检测工作表是否存在 Function excel101(ByVal gx As String, ByVal check1 As String) As Boolean ' 关系 工作表名 Dim i As Integer Dim flg As Boolean = False Try If gx = "存在" Then flg = False For i = 1 To xls.Sheets.Count If xls.Sheets(i).name.ToString.ToLower = check1.ToLower Then flg = True End If Next Else flg = True For i = 1 To xls.Sheets.Count If xls.Sheets(i).name.ToString.ToLower = check1.ToLower Then flg = False End If Next End If Catch ex As Exception flg = False End Try excel101 = flg End Function
Excel自动批改系统_编号008,文档纸张页脚边距 'Excel阅卷:编号008,文档纸张页脚边距 Function excel008(ByVal gx As String, ByVal check1 As String) As Boolean ' 检测值 Dim flg As Boolean = False Try If gx = "等于" Then If Abs(sheet.PageSetup.FooterMargin - check1 * 0.393700787 * 72) < 1 Then flg = True Else flg = False End If End If If gx = "不等于" Then If Abs(sheet.PageSetup.FooterMargin - check1 * 0.393700787 * 72) > 1 Then flg = True Else flg = False End If End If If gx = "大于" Or gx = "大于等于" Then If sheet.PageSetup.FooterMargin - check1 * 0.393700787 * 72 + 1 >= 0 Then flg = True Else flg = False End If End If If gx = "小于" Or gx = "小于等于" Then If sheet.PageSetup.FooterMargin - check1 * 0.393700787 * 72 - 1 <= 0 Then flg = True Else flg = False End If End If Catch ex As Exception flg = False End Try excel008 = flg End Function
Excel自动批改系统_编号007,文档纸张页眉边距 'Excel阅卷:编号007,文档纸张页眉边距 Function excel007(ByVal gx As String, ByVal check1 As String) As Boolean ' 检测值 Dim flg As Boolean = False Try If gx = "等于" Then If Abs(sheet.PageSetup.HeaderMargin - check1 * 0.393700787 * 72) < 1 Then flg = True Else flg = False End If End If If gx = "不等于" Then If Abs(sheet.PageSetup.HeaderMargin - check1 * 0.393700787 * 72) > 1 Then flg = True Else flg = False End If End If If gx = "大于" Or gx = "大于等于" Then If sheet.PageSetup.HeaderMargin - check1 * 0.393700787 * 72 + 1 >= 0 Then flg = True Else flg = False End If End If If gx = "小于" Or gx = "小于等于" Then If sheet.PageSetup.HeaderMargin - check1 * 0.393700787 * 72 - 1 <= 0 Then flg = True Else flg = False End If End If Catch ex As Exception flg = False End Try excel007 = flg End Function
Excel自动批改系统_编号006,文档纸张右边距 'Excel阅卷:编号006,文档纸张右边距 Function excel006(ByVal gx As String, ByVal check1 As String) As Boolean ' 检测值 Dim flg As Boolean = False Try If gx = "等于" Then If Abs(sheet.PageSetup.RightMargin - check1 * 0.393700787 * 72) < 1 Then flg = True Else flg = False End If End If If gx = "不等于" Then If Abs(sheet.PageSetup.RightMargin - check1 * 0.393700787 * 72) > 1 Then flg = True Else flg = False End If End If If gx = "大于" Or gx = "大于等于" Then If sheet.PageSetup.RightMargin - check1 * 0.393700787 * 72 + 1 >= 0 Then flg = True Else flg = False End If End If If gx = "小于" Or gx = "小于等于" Then If sheet.PageSetup.RightMargin - check1 * 0.393700787 * 72 - 1 <= 0 Then flg = True Else flg = False End If End If Catch ex As Exception flg = False End Try excel006 = flg End Function
Excel自动批改系统_编号005,文档纸张左边距 'Excel阅卷:编号005,文档纸张左边距 Function excel005(ByVal gx As String, ByVal check1 As String) As Boolean ' 检测值 Dim flg As Boolean = False Try If gx = "等于" Then If Abs(sheet.PageSetup.LeftMargin - check1 * 0.393700787 * 72) < 1 Then flg = True Else flg = False End If End If If gx = "不等于" Then If Abs(sheet.PageSetup.LeftMargin - check1 * 0.393700787 * 72) > 1 Then flg = True Else flg = False End If End If If gx = "大于" Or gx = "大于等于" Then If sheet.PageSetup.LeftMargin - check1 * 0.393700787 * 72 + 1 >= 0 Then flg = True Else flg = False End If End If If gx = "小于" Or gx = "小于等于" Then If sheet.PageSetup.LeftMargin - check1 * 0.393700787 * 72 - 1 <= 0 Then flg = True Else flg = False End If End If Catch ex As Exception flg = False End Try excel005 = flg End Function
首页
1
2
下一页