Step 2 Complete Function iiiFN14

LANSA Integrator

Step 2. Complete Function iiiFN14

INT012 - Create Excel Document with Template and Formatting

In this step you will use an Excel template called Employs.xlt which looks like the image following.

Create the Excel template (XLT) before continuing.

 Note:    

The list of employees will need to be placed in Row 5, Column 2.

     The list of employees area has a left and right border, which will need to be defined before writing the Excel document.

1.  Open and review your copy of the Employs.xlt template.

2.  To write the Excel document using the template you need to add the TEMPLATE keyword to the ExcelReadService OPEN command. Your code should look like the following:

#jsmxcmd := 'OPEN FILE(training/iiiemp' + #datetimec + '.XLS) MODE(*WRITE) TEMPLATE(training/employs.xlt)'

USE BUILTIN(jsmx_command) WITH_ARGS(#jsmxhdle1 #jsmxcmd) TO_GET(#jsmsts #jsmmsg)

EXECUTE SUBROUTINE(CHECK_STS)

3.  You now need to write the working list of employees to Row 5, Column 2. Modify your WRITE command as required. Your code should look like the following:

* Write to Excel file

#jsmxcmd := 'WRITE R1C1(5,2)'

USE BUILTIN(jsmx_command) WITH_ARGS(#jsmxhdle1 #jsmxcmd) TO_GET(#jsmsts #jsmmsg #employs)

EXECUTE SUBROUTINE(CHECK_STS)

4.  Compile function iiiFN14.