PreviousNext
Help > Programming with LAUNCHER Office > Advanced programming > Word > LAUNCHER Office and Word
LAUNCHER Office and Word

 LAUNCHER Office supports all Word versions from Office 2010 up to Office 2019.

 

Using the command LNCPRTDOC is the easiest way to insert external database data in a Word document.

If this command do not allow to meet your requested detail level, use LNCOPEN, LNCCMD and LNCCLOSE commands.

 

To use Word from an AS/400 program, the following procedure must be applied :

 

/* State and initialise the program variables */

 DCL VAR(&HANDLE) TYPE(*CHAR) LEN(50) VALUE('*ONLY')

 DCL VAR(&SVRADD) TYPE(*CHAR) LEN(30) VALUE('*DEV')

 DCL VAR(&CCSID) TYPE(*CHAR) LEN(10) VALUE('*JOB')

 DCL VAR(&OPT) TYPE(*CHAR) LEN(1)

 DCL VAR(&CMD) TYPE(*CHAR) LEN(10)

 DCL VAR(&PARM1) TYPE(*CHAR) LEN(512)

 DCL VAR(&PARM2) TYPE(*CHAR) LEN(1024)

 DCL VAR(&RESULT) TYPE(*CHAR) LEN(512)

 

/* Open communication between AS/400 PGM and PC */

 CALL PGM(LNCOPEN) PARM(&HANDLE &SVRADDR &CCSID)

 

/* Open Word, and a document template is necessary */

 CHGVAR VAR(&CMD) VALUE('WORDOPEN')

 CHGVAR VAR(&PARM1) VALUE(' ')

 CHGVAR VAR(&PARM2) VALUE(' ')

 CALL PGM(LNCCMD) PARM(&HANDLE &OPT &CMD &PARM1 &PARM2 &RESULT)

 

/* Proceed with the document lay out */

/* . . . */

 

/* Save, Print, Display the document (Optional) */

/* . . . */

 

/* Close document and Word (Optional) */

 CHGVAR VAR(&CMD) VALUE('WORDCLOSE')

 CHGVAR VAR(&PARM1) VALUE(' ')

 CHGVAR VAR(&PARM2) VALUE(' ')

 CALL PGM(LNCCMD) PARM(&HANDLE &OPT &CMD &PARM1 &PARM2 &RESULT)

 

/* Fermer la communication */

 CALL PGM(LNCCLOSE) PARM(&HANDLE)

 

To lay out the document, "bookmarks" or "Mailing" procedure can be used.