Creating Predefined Excel Template Files
(Windows Front-End)
Predefined template files are supplied with certain solutions, for example HOPEX LDC.

This function is available with
HOPEX Windows Front-End only.
Each predefined template file is associated with an Excel file. Management of this Excel file is assured by HOPEX from system business documents.
Creating Excel Templates
To create an Excel template:
1. From the HOPEX Windows Front-End desktop, select View > Navigation Windows > Utilities.
2. Right-click the Excel Templates folder and select New > Excel Template.
3. Open the properties dialog box of the Excel template you have just created and select the Characteristics tab.
4. Click the arrow at the right of the System Business Document field and select Create System Business Document.
The system business document creation dialog box opens.
5. Define the System Business Document name and the File Location of the Excel template you want to use.
6. In the Document Template field, select Excel Import/Export Template.

The system business document must belong to document category
Excel Import/Export Templates or to a sub-category. For more details, see
"Classification", page 446.
7. Click OK.
The system business document is created.
8. In the MetaClass section, click the Connect button to select the MetaClasses representing the main concepts managed by the template.
9. In the Excel Worksheet section, click New for each Excel worksheet you want to add to your file.
10. Click OK to finish.
Creating Excel Template Worksheets
An Excel template worksheet should define information required for creation of an Excel import/export worksheet.
Information defined in columns of the Excel worksheet is Excel template data referenced by the system business document.
To create an Excel template worksheet:
1. Open the properties dialog box of the Excel template you want to attach to the worksheet.
2. In the Excel Worksheet space, click the New button.
3. In the properties of the Excel template worksheet you have created to specify a link type:
• In the MetaClass column, select the master MetaClass (for example "Application").
• In the MetaAssociationEnd column, select the MetaAssociationEnd (for example "Defined Service").
• In the Slave MetaClass column, select the slave MetaClass (for example "Application Service").
4. In the Macro section, click the Connect button to specify the macros that will be proposed by the wizard to fill the columns of the Excel export files.
5. Click OK to finish.
Using Macros in Excel Import/Export Files
A macro enables export to Excel and import to MEGA of calculated attribute values, for example: the result of a sum of whole numbers.
To use the VB macro creation wizard on an object of Business Document type:
1. In Tools > Options, Repository folder, check that Metamodel Access option is set to "Expert".
2. Open the properties dialog box of the of the Excel worksheet
3. In the Macro section, click the New button.
The macro creation wizard opens.
4. Select the check box corresponding to the type of macro you want to use, for example:
• "(VB) Script macro"
• "macro based on component"
• "java macro":
• "existing macro": to use an existing macro, of which field Reusable is selected.
5. Click Next.
6. Enter the Name of the macro.
7. If the macro you have created can be reused for another Excel import/export, select the Reusable box.
8. Click Finish.
The constraint appears in the properties dialog box.
The macro created contains by default the code of functions enabling encoding of operation of:
• Export, with the ColumnExport function that has as parameters:
• The object being exported.
• The list of header columns in the form of megafields.

This parameter is a character string that should be broken down using character "#" as separator.
• The index in the list of columns of the column being exported.
• Import, with the ColumnImport function that has parameters:
• The object being imported.

This object can be an object created by import or an existing object modified by import.
• The value of the Excel cell being imported.
• The list of header columns in the form of megafields.

This parameter is a character string that should be broken down using character "#" as separator.
• The list of values of cells of the row being imported.

This parameter is a character string that should be broken down using character "#" as separator.
• The index in the list of columns of the column being imported.