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
