Opens WORD document.
This synthesis command is somewhat similar to WOPENFILE or WNEWFILE command with opportunity to include parameters equivalent to WORDSHOW/WORDHIDE and WMAXIMIZE/WMINIMIZE commands.
Word must be opened before with WORDOPEN command.
Syntax
CHGVAR |
VAR(&CMD) VALUE('WDOCUMENT') |
CHGVAR |
VAR(&PARM1) VALUE('File name' OU ' 'Template name') |
CHGVAR |
VAR(&PARM2) VALUE(' [Directory="Directory path";] [Document="File name";] [Detach = True/False;] [Visible;] [ReadOnly;] [New;] [Minimize;] [Maximize;] [DOCPWD="Password for opening";] [WRTPWD="Password for modification";] ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
Parameters |
|
Parm1 |
Name of the file to open. It may be empty if a new document has to be created, or includes a template name, if NEW is specified as parameter 2.
|
Parm2
RESULT |
Directory This directory path is added in front of the path and the file name given in parameter 1. Document If the requested document is already open, it is made active, it becomes the current document for Word. No new file is opened, so the name of the file or template is ignored.
Detach =
True/False When a document is opened and attached to a data source (Merge File), it is maintained by Word, and therefore not editable. You must detach the data source from the current document if you want to send new data to the merge file.
VISIBLE =to show Word.
MINIMIZE= window is reduced.
MAXIMIZE= window is widened.
READONLY = open for reading only. Default value is False
NEW = allows to create a new document if Parm1 is empty.
DOCPWD = opening password. Uppercase/lowercase must be respected if the document is password protected.
WRTPWD= modification password. Must be filled if the document is modification protected.
NOTICE !!! Word must be shown to open a password protected document.
Name of the document When returning the WDOCUMENT command, the &RESULT parameter contains the name of the active document. For a document opened from a file, the name of the document is equal to the name of the file, without the path and without the suffix ".DOCX". If the document has just been created, its name was built by Word.
|
Example
Creates a new document in a widened and visible window.
CHGVAR |
VAR(&CMD) VALUE('WDOCUMENT') |
CHGVAR |
VAR(&PARM1) VALUE(' ') |
CHGVAR |
VAR(&PARM2) VALUE('VISIBLE;MAXIMIZE;NEW') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 &PARM2 &RESULT) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
Opens Rapport.docx document, reading only, in a reduced window.
CHGVAR |
VAR(&CMD) VALUE('WDOCUMENT') |
CHGVAR |
VAR(&PARM1) VALUE('C:\temp\Rapport.docx') |
CHGVAR |
VAR(&PARM2) VALUE('VISIBLE;MINIMIZE;READONLY') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
MONMSG |
MSGID(LNC0000) EXEC(GOTO CMDLBL(ERROR)) |
See also
• WORDOPEN
• WNEWFILE