INT012 - Create Excel Document with Template and Formatting
In this step you will use the ADD command to insert a formula to total the salary column.
1. Immediately following the SELECT/ENDSELECT loop which loads the list of employees add code to insert a total line. Your code should look like the following:
* Insert total line
#employs := *null
#surname := 'Salary Total:'
Add_Entry To_List(#employs)
2. Following the WRITE to Excel logic, insert the following code:
* Add Total Salary Formula
#std_num := (#listcount + 3)
#listcount += 4
*
#jsmxcmd := 'ADD OBJECT(*FORMULA) FORMULA("SUM(G5:G' + #std_num.asstring + ')") R1C1(' + #listcount.asstring + ',7)'
Use Builtin(jsmx_command) With_Args(#jsmxhdle1 #jsmxcmd) To_Get(#jsmsts #jsmmsg)
Execute Subroutine(CHECK_STS) With_Parms(#JSMXHDLE1)
Note:3. Recompile your function and test it to check that your formula has been correctly inserted.