All you need to do in order to To write data to a file is toperform the following actions:
- set up the template using reporting_setupTemplate routine
- set up the template's sheets using reporting_setupSheet routine
- add the data to the coresponding sheet using reporting_addData routine
- write the data added to a temporary file using reporting_writeWorkbook routine
- return the file created
- set up the template using reporting_setupTemplate routine
...
The file above can be included into another SIL files by using this syntax:
Code Block |
---|
include "SER_funcs.incl"; |
An easy example using this file would be one that returns some certain employees, their age and their salary. Below are the execution Execution script and the parameter script for such an example .are represented below:
Code Block | ||
---|---|---|
| ||
include "SER_funcs.incl"; string templateFile = gadget_getSingleValue(argv, "Template file"); string sheetName = gadget_getSingleValue(argv, "Sheet name"); date startDate = gadget_getDateValue(argv, "Start Date"); //setting up headers and column types string[] headers = {"Name", "Position", "Age", "Wage"}; number[] columnTypes = {0, 0, 1, 1}; string[] data = {"John Doe", "Developer", "30", "1300.50", "Paul Smith", "Project Manager", "41", "2500.00", "Simon Desharnais", "Tester", "35", "900.20"}; SheetProp sheetProp; sheetProp.sheet = sheetName; sheetProp.heading = headers; sheetProp.data = data; sheetProp.dataTypes = columnTypes; return ser_writeDataInExcel(templateFile, true, {sheetProp}); |
...