Using Word for reports


#1

Hello,
I am new to clarion and I was wondering is there a way to use Microsoft word for reports. I know in other programs I have used we would use word as a template and used key fields to get the data from the database.


#2

Can you use office templates


#3

Not sure what you mean. I created word files and placed them in a directory and I want to call from ok button as a report. But in the word doc it would have links back to the database


#4

Hi,

If you are looking for something like a mail merge functionality you can check TX Text Control/Clarion wrapper
http://klarisoft.com/KSNews_idx21.htm
MS Word format is supported

Leonid


#5

Depending on the Clarion package you have, you might consider using the Report Writer that ships with Clarion, rather than Word. You will achieve similar, a report that takes from the database, have something that can be distributed but obviously not as a Word document.

If you want to call the reports directly from a Clarion program you would best design the reports with the in-built report formatter, reading from the database and then there is no need for Word documents at all. Doing it that way means you can prevent anyone who doesn’t have password access to your programs running the reports, which can also address GDPR concerns.


#6

using office templates you can open word document and search and remplace token with your database fields
example
MSWord1.Init(Window,?SMWord,1,1,1)
MsWord1.OpenDoc(CLIP(LOC:SS),False)

MSWord1.Replace('[NUMERO]',FORMAT(EMP:NUMERO,@N05),False,False)
MSWord1.Replace('[ANOS_EDAD]',CLIP(LOC:SS),False,False)
MSWord1.Replace('[CURP]',CLIP(EMP:CURP),False,False)
MSWord1.Replace('[RFC]',CLIP(EMP:RFC),False,False)
MSWord1.Replace('[IMSS]',CLIP(EMP:IMSS),False,False)
MSWord1.Replace('[LUGAR_NAC]',CLIP(EMP:LUGAR),False,False)
MSWord1.Replace('[CALLE]',CLIP(EMP:CALLE),False,False)
MSWord1.Replace('[COLONIA]',CLIP(COL:NOMBRE),False,False)
MSWord1.Replace('[PUESTO]',CLIP(EMP:DESPUESTO),False,False)
MSWord1.Replace('[FVENCE]',FORMAT(EMP:VENCE,@D2),False,False)
MSWord1.Replace('[SALARIO]',CLIP(FORMAT(EMP:SALARIO,@N$9.2B)),False,False)

#7

I use office templates and they work very well for me. Excel, Word and in specific cases of mail through Ms OutLook.