Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LPARAMETERS cSignee,cTitle,ldDate,nCheck
LOCAL cWordTemplate,loTemplate,nCount,x,loDocument
x = 0
cWordTemplate = GETFILE("dot","Get letter template","Use")
IF !EMPTY(cWordTemplate)
oWord = CREATEOBJECT("word.application")
this.oWord = .t.
oWord.Documents.OPEN(cWordTemplate)
loTemplate=oWord.SELECTION
loTemplate.WholeStory
loTemplate.COPY
loDocument=oWord.Documents.ADD()
SELECT EMP2
GO TOP
COUNT TO nCount
GO TOP
DO WHILE !EOF()
x = x + 1
WITH oWord
loSelection = oWord.SELECTION
loSelection.PageSetup.TopMargin = 30
loSelection.InlineShapes.AddPicture("c:\word letter\graphics\slpcanada2.bmp")
loSelection.PageSetup.RightMargin=50
loSelection.PageSetup.LeftMargin=50
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.PageSetup.BottomMargin = 30
loSelection.FONT.SIZE = 12
loSelection.FONT.NAME = "times"
loSelection.TypeText(ALLTRIM(ldDate))
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.Font.Bold = .t.
loSelection.TypeText(ALLTRIM(PROPER(EMP2.empfname))+" "+ALLTRIM(PROPER(EMP2.emplName)))
loSelection.typeparagraph
loSelection.FONT.SIZE = 10
loSelection.FONT.NAME = "times"
loSelection.Font.Bold = .f.
loSelection.TypeText(ALLTRIM(EMP2.address))
loSelection.typeparagraph
loSelection.TypeText(ALLTRIM(EMP2.city)+", "+ALLTRIM(EMP2.province))
loSelection.typeparagraph
loSelection.TypeText(SUBSTR(EMP2.postal,1,3)+"-"+SUBSTR(EMP2.postal,4,3))
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.FONT.SIZE = 12
loSelection.FONT.NAME = "times"
IF nCheck = .t.
loSelection.TypeText(IIF(!EMP2.madame,"Monsieur","Madame")+" "+ALLTRIM(PROPER(EMP2.emplName)))
ENDIF
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.Paste
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.typeparagraph
loSelection.typeparagraph
IF x < nCount
loSelection.insertbreak()
ENDIF
ENDWITH
SELECT EMP2
SKIP
ENDDO
nAnswer = MESSAGEBOX("Do you want to print to document(s)?",36,"Letter")
IF nAnswer = 6
oWord.printout()
loDocument.SAVEAS("c:\word letter\documents\letter.doc")
DELETE FILE c:\word letter\documents\letter.doc
ENDIF
ELSE
MESSAGEBOX("You have not selected a template, please try again.")
ENDIF