📄 成绩单.txt
字号:
Set safety off
Open database "D:\学生管理系统\数据\学生管理"
oWord = CREATEOBJECT("Word.Application")
oWord.visible=.t.
oWord.documents.add
oWord.ActiveWindow.View.Type=3
With oWord.ActiveDocument.PageSetup
.LineNumbering.Active = .F.
.TopMargin = 72
.BottomMargin = 72
.LeftMargin = 90
.RightMargin = 90
.Gutter = 0
.HeaderDistance = 42.55
.FooterDistance = 49.6
.PageWidth = 595.35
.PageHeight = 841.95
.OddAndEvenPagesHeaderFooter = .F.
.DifferentFirstPageHeaderFooter = .F.
.SuppressEndnotes = .F.
.MirrorMargins = .F.
.TwoPagesOnOne = .F.
Endwith
oWord.Selection.font.bold=.T.
oWord.Selection.font.name='宋体'
oWord.Selection.font.size=20
oWord.Selection.typetext(" 成 绩 单")
oWord.Selection.font.bold=.F.
oWord.Selection.font.italic=.T.
oWord.Selection.font.size=10
oWord.Selection.TypeParagraph
oWord.Selection.typetext(" "+allt(str(year(date())))+"-"+allt(str(month(date())))+"-"+allt(str(day(date()))))
oWord.Selection.font.size=5
oWord.Selection.font.italic=.F.
oWord.Selection.TypeParagraph
oWord.Selection.TypeParagraph
Select 学号,姓名,专业、班级 from 学生档案 where 专业、班级="" order by 学号 into table temp
For ID68003W=1 to reccount()
oWord.Selection.font.bold=.T.
oWord.Selection.font.name='宋体'
oWord.Selection.font.size=10.5
Go ID68003W
Local cNo
cNo=temp.学号
oWord.ActiveDocument.Tables.Add(oWord.Selection.Range,1,1)
oWord.Selection.MoveRight(2,1,2)
oWord.selection.Borders.OutsideLineWidth=12
oWord.Selection.MoveLeft
oWord.Selection.typetext(学号+" "+姓名+" "+专业、班级)
oWord.Selection.MoveRight(2,2)
oWord.Selection.font.bold=.F.
Select 课程,成绩,补考成绩 from 学生成绩表 where 学生成绩表.学号=cNo into table temp1
oWord.ActiveDocument.Tables.Add(oWord.Selection.Range,reccount()+1,4)
oWord.Selection.typetext("课程")
oWord.Selection.MoveRight
oWord.Selection.typetext("成绩")
oWord.Selection.MoveRight
oWord.Selection.typetext("补考成绩")
oWord.Selection.MoveRight
oWord.Selection.typetext("是否通过")
oWord.Selection.MoveRight
For j=1 to reccount()
Go j
oWord.Selection.typetext(课程)
oWord.Selection.MoveRight
oWord.Selection.typetext(allt(str(成绩,5,1)))
oWord.Selection.MoveRight
oWord.Selection.typetext(iif(!empty(补考成绩),allt(str(补考成绩,5,1)),""))
oWord.Selection.MoveRight
If (成绩>=0 and 补考成绩>=60) or (成绩<60 and 补考成绩>=60) or (成绩>=60 and empty(补考成绩)) or (empty(成绩) and 补考成绩>=60)
oWord.Selection.typetext("通过")
oWord.Selection.MoveRight
Else
If (成绩<60 and 补考成绩<60) or (empty(成绩) and empty(补考成绩)) or (empty(成绩) and 补考成绩<0) or (成绩<60 and empty(补考成绩))
oWord.Selection.typetext("未过")
oWord.Selection.MoveLeft(2,2,2)
oWord.Selection.font.color=rgb(255,0,0)
oWord.Selection.MoveRight(2,2)
Else
oWord.Selection.typetext("?")
oWord.Selection.MoveLeft(2,1,2)
oWord.Selection.font.color=rgb(255,202,0)
oWord.Selection.font.bold=.T.
oWord.Selection.MoveRight(2,2)
Endif
Endif
Endfor
Use in temp1
Delete file temp1.*
oWord.Selection.MoveRight
oWord.Selection.TypeParagraph
Select 学号,姓名,专业、班级 from 学生档案 where 专业、班级="" order by 学号 into table temp
Endfor
mypagenum=oWord.Selection.Sections(1).Headers(1).PageNumbers
mypagenum.NumberStyle=0
mypagenum.HeadingLevelForChapter=0
mypagenum.IncludeChapterNumber=.f.
mypagenum.ChapterPageSeparator=0
mypagenum.RestartNumberingAtSection=.f.
mypagenum.StartingNumber=0
oWord.Selection.Sections(1).Footers(1).PageNumbers.Add (1,.t.)
Use in temp
Delete file temp
oWord.quit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -