xxxhsn xxxhsn
关注数: 10 粉丝数: 71 发帖数: 956 关注贴吧数: 12
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语句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自动批改系统_编号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自动批改系统_编号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自动批改系统_编号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
首页 1 2 下一页