Inserts text at the specified bookmark location.
Syntax
CHGVAR |
VAR(&CMD) VALUE(WBOOKMARK) |
CHGVAR |
VAR(&PARM1) VALUE(' [ Bookmark="Nom de signet" ] + [ ;Start] [ ;End] [ ;Overtype] [ ;Adjust] [ ;Append] + [ ;InsertRow] [ ;Merge=n] + [ ;Unicode=True/False
] + [ ;NUMFMT(d DECPOINT=p GRPPOINT=g)] + [ ;PROP(Property)=Value] + ')
|
CHGVAR |
VAR(&PARM2) VALUE('Texte à insérer') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
Parameters |
|
Parm1 |
Bookmark is the name of a bookmark present in the document, or a predefined bookmark of Microsoft Word, or a special value - see the notes below. A bookmark represents a position in the document, or a selection (range) of several characters. A bookmark is placed in a Word document by the "Insert" menu "Bookmark" of Word. If the bookmark name is missing in Parm1, or, if it is equal to *NONE, then the Word cursor is not moved, and the text will be inserted at the current position. If the bookmark specified here is missing from the document, no action is performed, and the word 'FALSE' is returned in the &RESULT parameter.
Start : When the bookmark is set to a selection, the Start option sets the cursor position at the beginning of the selection.
End : When the bookmark is set to a selection, the End option sets the cursor position at the end of the selection.
Overtype : the new text is typed over the existing text. By default the new text is inserted, or it replace the whole selection.
Adjust will set the new location for the bookmark, on the inserted text. Append adds the new value to the current contents of the bookmark. InsertRow inserts a row into a table at the bookmark location. Merge : merges the n cells into one.
NUMFMT(d
DECPOINT=p GRPPOINT=g) to format a decimal digital value.
PROP sets
the value of a property at the new cursor position.
Unicode : False
by default. When Unicode is true, the text in &PARM2 must be in the
Windows Unicode character set. Unicode is helpful to read and write foreign character sets, like Chinese, Korean, ...
ToBookmark allows you to designate a bookmark. The selection will be extended to this bookmark, from the bookmark specified with the Bookmark parameter, or from the current position if Bookmark is not specified.
|
Parm2 |
Text
to insert. If option Unicode is true, content of &PARM2 must be in Windows Unicode character set. And parameter &OPT must be set to ‘W’.
|
Opt |
When option Unicode is true, &OPT must be set to ‘W’. &PARM2 must be coded in the Windows Unicode character set.
|
Notes
1) Allowed bookmark name values :
• Bookmark name inserted in document template.
• Microsoft Word Bookmarks preset.
• *RIGHT to move to right cell.
• *LEFT to move to left cell.
• *UP to move to upper cell.
• *DOWN to move to lower cell.
If the bookmark does not exist, no text will be inserted.
2) If bookmark includes several selected characters, the whole selection will be replaced with the new value.
3) WBOOKMARK command may serve to delete all paragraphs included in the bookmark.
4) Bookmarks can overlay.
5) Bookmarks may be placed anywhere in a document, including headers, footers or watermarks.
6) Word fits display mode automatically.
7) In all cases, move take place before text inserting.
Example 1
CHGVAR VAR(&CMD) VALUE('WBOOKMARK')
CHGVAR VAR(&PARM1) VALUE('Bookmark="Bookmark1";NUMFMT(0)')
CHGVAR VAR(&PARM2) VALUE('0001234')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
Result : 1234
CHGVAR VAR(&CMD) VALUE('WBOOKMARK')
CHGVAR VAR(&PARM1) VALUE('Bookmark="Bookmark2";NUMFMT(2)')
CHGVAR VAR(&PARM2) VALUE('0001234')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
Result : 12.34
Example 2
CHGVAR VAR(&CMD) VALUE('WORDOPEN')
CHGVAR VAR(&PARM1) VALUE('FILE="C:\TEMP\TEST.DOCX"')
CHGVAR VAR(&PARM2) VALUE('VISIBLE')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
CHGVAR VAR(&CMD) VALUE('WBOOKMADD')
CHGVAR VAR(&PARM1) VALUE('Bookmark="S1"')
CHGVAR VAR(&PARM2) VALUE(' ')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
CHGVAR VAR(&CMD) VALUE('WBOOKMARK')
CHGVAR VAR(&PARM1) VALUE('Bookmark="S1";NUMFMT(2 DECPOINT=, GRPPOINT=.)')
CHGVAR VAR(&PARM2) VALUE('12345678')
CALL PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 +
&PARM2 &RESULT)
Exemple 3
LNCCMD CMD(WBOOKMADD) +
PARM1('Bookmark="Name";Text="Client name"')
LNCCMD CMD(WBOOKMARK) +
PARM1('Bookmark="Name";Start;Overtype;Adjus+
t;PROP(Font.bold)=True;Prop(Font.italic)=Tr+
ue') PARM2('Aura Equipements')
RPG Example
If AS/400 sends value 12345678 in the following format :
NUMFMT(2 DECPOINT=, GRPPOINT=.)
Printed value is displayed as:
123.456,78
The following RPG example :
EVAL LNC_PARM2=*BLANKS
EVAL LNC_PARM1=’*RIGHT NUMFMT(2)’
MOVEL SUM LNC_PARM2
CALL ‘LNCCMD’
. . .
allows digital data on AS/400 side and formatted text zone on the document.
If
SUM variable value is 12350 (data sent to LAUNCHER Office is
shown as in UPDDTA, excepted for decimal point) with two figures as decimal
positions.
LAUNCHER Office will insert the value 123.50 in the document.
How to format a date?
There are no LAUNCHER Office commands for WORD to format dates.
The user must therefore use the command "CVTDAT" on the AS/400.
However, in the case of a mail merge, it is possible to define the date format in the WORD document for all "MERGEFIELD" fields.
See also