With the Excel Generator you can create Excel documents out of complex structured data.Data Model of the Excel Generator
This adapter uses a template file (Excel 97-2003 or Excel 2007 format) to create an Excel document. The data are specified by a map. The key values are used to reference their corresponding Data structure.
![](/download/attachments/2287564/excel_generator_data_model.png?version=1&modificationDate=1576756418000&api=v2)
Procedure for Using the Excel Generator
- The adapter uses jXLS for configuring and building the resulting Excel documents. Create an Excel template file containing your jXLS.
![](/download/attachments/2287564/excel_generator_jxls.png?version=1&modificationDate=1576756947000&api=v2)
To get a deeper understanding of the syntax used in the XLS templates, refer to the jXLS documentation. - Create the needed objects in an action script in your UML model and provide the data.
![](/download/attachments/2287564/excel_generator_action_script.PNG?version=1&modificationDate=1576756702000&api=v2)
- Call the Excel generator.
Building an Excel Document
Figure: Relationships between the Action Script and the jXLS
generateExcel( filename : String, data : StringData[], templateFilename : String )
Parameter | Direction | Description |
---|
filename | in | The filename of the Excel output file. |
data | in | The map holding the data to be written to the Excel file. |
templateFilename | in | The filename of the Excel template file. |
The creation of an Excel document then is as simple as shown in the activity diagram below. Action create data contains the action script.
![](/download/attachments/2287564/excel_generator_activity_diagram.PNG?version=1&modificationDate=1576756418000&api=v2)
You can extract the javadoc folder from excelgenerator.jar to get additional information on the Java methods wrapped by this adapter.