VFP如何调用个人课表模板文件,一页纸上生成两张个人课表
VFP如何调用个人课表模板文件,一页纸上生成两张个人课表?下列代码一页纸上只能生成一张个人课表,如何修改下列代码实现一页纸上生成两张个人课表?请高手赐教,万分感谢!!!
课表文件.zip
(10.46 KB)
SET TALK OFF
SET SAFETY OFF
CLOSE ALL
CLEAR
wjm=SYS(5)+SYS(2003)+"\grkbmb1.doc"
WordApp=CREATEOBJECT("word.application")
USE jsmd20180912 ALIAS jsmd20180912 IN 0
USE jsrkb20190101 ALIAS jsrkb20190101 IN 0
USE kb20190101 ALIAS kb20190101 IN 0
SELECT jsmd20180912
GOTO top
rkmc=""
SCAN
xm=ALLTRIM(姓名)
rkmc=xm+","
WordTable=WordApp.Application.Documents.Open(wjm)
WordApp.Visible =.t.
SELECT jsrkb20190101
GOTO top
SCAN
FOR i=1 TO fcount()
m=FIELD(i)
xm2= &m.
IF ALLTRIM(xm2)=ALLTRIM(xm) then
rkmc=rkmc+FIELD(i)+nj+bj+','
zk( m,nj,bj)
ENDIF
NEXT i
ENDSCAN
WORDAPP.ActiveDocument.Content.Find.Execute('ABCDEF',.F.,.F.,.F.,.F.,.F.,.F.,.F.,.F.,'&xm',2)
oFile=SYS(5)+SYS(2003)+"\"+ALLTRIM(xm)+"_课程表.doc"
WordApp.Documents(1).SaveAs(oFile)
WordApp.ActiveDocument.Close
SELECT jsmd20180912
ENDSCAN
WORDAPP.quit
WORDAPP=.NULL.
CLOSE ALL
QUIT
PROCEDURE zk
LPARAMETERS kcm,lnj,lbj
LOCAL j,zkm,xq,jc,zkkm
SELECT kb20190101
GOTO top
LOCATE FOR ALLTRIM(nj)=ALLTRIM(lnj) AND ALLTRIM(bj)=ALLTRIM(lbj)
IF NOT EOF() THEN
FOR j=3 TO FCOUNT()
zkm=FIELD(j)
zkkm= &zkm.
IF ALLTRIM(zkkm)=ALLTRIM(kcm) then
xq=VAL(SUBSTR(zkm,5,1))
jc=VAL(SUBSTR(zkm,6,1))
scsz=ALLTRIM(nj)+ALLTRIM(bj)+ALLTRIM(kcm)
WordTable.Tables.item(1).Cell(jc+1,xq+2).Range.Text="&scsz"
ENDIF
NEXT j
ENDIF
SELECT kb20190101
RETURN