Allows you to perform actions on a cell or group of cells.
- Read the value
- Change the value
- Change the formula of the cell
- Change the format
- Assign a name
- Edit properties
- Read a property
Syntax
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1)
VALUE(' [;IgnoreError=True/False] |
CHGVAR |
VAR(&PARM2) VALUE('Value assigned to cells') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
Parameters |
|
Parm1 |
- Syntax $B$3. Example: $B$3 denotes column B, row 3. - Syntax CL. C to designate the column and L to designate the row. Example: B3 designates row 3, and column 2 (B). - Symbolic name given to a cell or group of cells. - "." will designate the active cell. Sheet:
Specifies the name of the sheet to be addressed. Row, Col: These two keywords represent respectively: - The coordinates (Line, Column) of a cell, if Ref is absent. - The relative coordinates in rows and columns from the base referenced by "Ref =" when it is present. The upper left cell has relative coordinates (1,1). RowCnt,
ColCnt:
These two keywords represent respectively the number of rows and columns
selected, from the reference given by Ref or by (Row, Col). RefTo:
Reference to the cell at the bottom right of the selected area. This
reference is given by key words Ref, Row and Col, in a
quoted string. NextOutline: When
this option is specified, LAUNCHER Office searches for the next row from the
active cell, with a hierarchy level matching the criteria. NEXTOUTLINE="1-2";SELECT;IgnoreError; PROP(INTERIOR.COLOR)=RGB(200;200;200); PROP(Font.Bold)= True SetValue : Indicates that the Parm2 parameter contains a value to assign to the cell. SetFormula : Indicates that the Parm2 parameter contains the text of a formula to apply to the cell. Format: Allows you to set the format of the cell or group of cells. Name: Give a name to the cell or group of cells. Comment: Add a comment to the cell. This comment is displayed by Excel when we fly over the cell with the mouse.
GetValue: Indicates that you want to receive the internal value of the cell, not the displayed value. The value will be returned in the &RESULT parameter. GetText:
Indicates that you want to receive the displayed value of the cell. The
displayed value may differ from the internal value. GetProp
("Property"): Returns the value of a property assigned to cells in
the referenced region. GetSize:
Returns in &RESULT the size of the region referenced by Ref. Select: True indicates that the cell or group of cells should be selected. Clear: True clears the cell. Freeze: True replaces the expressions with their calculated values. Calculate: True recalculates the entire workbook. Merge: When
this keyword is specified, the merge of the cells in the selection is
changed. xlAll: All
cells in the selection are merged into a single cell. Prop(): allows
to modify a property of the pointed cells. IgnoreError: If this option is true, in the event of an error, no message will be generated, and the value "*ERROR" will be returned in &RESULT.
DateFmt(format) : When
a date value is provided in the "Parm2" parameter, this keyword
indicates in what format this value is. Examples: NumFmt
(format)
: When a decimal number, without a decimal point, is provided in the
"Parm2" parameter, this key word indicates how many decimal places
have this number. Unicode: When
Unicode is true, the value read by GetValue, GetText, or
written by SetValue is in the Unicode character set of Windows.
|
Parm2 |
If one of the keywords SetValue or SetFormula is set into Parm1, then Parm2 contains the value for the cell or the formula. If
Unicode is true, &PARM2 value must be in Unicode character set,
|
Opt |
When option Unicode is true, &OPT must be set to 'W'. &PARM2 must be coded in the Windows Unicode character set.
|
Examples
|
/* Read the value of cell B2 */ |
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1) VALUE('Ref="$B$2";SetValue=True;GetText=True') |
CHGVAR |
VAR(&PARM2) VALUE(&NEWVAL) |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
|
/* &RESULT contient l’ancienne valeur de B2 */ |
|
/* Change the format of the cell Row 10, Column 5*/ |
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1) VALUE('Row=10;Col=5;Format="# ##0,00"') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
|
|
|
/* Write a Chinese text in a cell */ |
|
/* Convert from chinese CCSID to unicode Windows */ |
CHGVAR |
VAR(&WCS_LEN) VALUE(512) |
CHGVAR |
VAR(&CCSID) VALUE(835) |
CALL |
PGM(LNCCVTWCS) PARM(&HANDLE '*TO ' &PARM2 &WCS_LEN + &CHINA &CHINA_LEN &CCSID &RES_SIZE) |
|
|
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1) VALUE('Ref="$B$2";SetValue=True;Unicode=True') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD 'W' &PARM1 + &PARM2 &RESULT) |
|
|
|
/* Select an area of 3 rows, 5 columns */ |
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1) VALUE('Ref="Table";RowCnt=3;ColCnt=5;Select') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
|
|
|
/* Select a zone */ |
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1) VALUE('Ref="Table";RefTo="FinTable";Select') |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
|
|
|
/* Select a zone */ |
CHGVAR |
VAR(&CMD) VALUE('XLCELLS') |
CHGVAR |
VAR(&PARM1)
VALUE('Ref="Table";+ |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
/* Apply formula */ |
|
LNCCMD CMD(XLCELLS) PARM1('Ref="H8";setformula=True;calculate=True') |
PARM2('=IF(ISERROR(-1+D5/E5)," ",-1+D5/E5)')
Note
To use the Font.Color property, it is necessary to use Windows color codes.
Color constants:
Constants values:
PROP(Font.Color)=vbMagenta
PROP(Font.Color)=INT(255) //red
You can also use BGR code with the RGB function:
PROP(Font.Color)=RGB(255,0,0) //blue
PROP(Font.Color)=RGB(0,255,0) // green
PROP(Font.Color)=RGB(0,0,255)
// red