Hi,
I have some groovy code that attempts to utilize ITemplateEngine to evaluate a velocity template file. The velocity template file has some import lines at the top that gives me access to the magicdraw API. Unfortunately when I create a template using createTemplate(inputFile, outputFile) and then evaluate the template using ITemplateEngine. I get one of the two following errors:
- #import com.nomagic.magicdraw.core.Application is not assignable from ITool
- Statement #import("generic",com.nomagic.reportwizard.tools.GenericTableTool) cannot be resolved.
Can I not use the standard velocity import statements from within my velocity template when using ITemplateEngine? If not, how do I get references to elements in my MD project that I want my template to act upon, or utilize OpenAPI/InternalAPI libraries from within the template to manage specific information, say Generic Tables?
My groovy code using ITemplateEngine is below:
import java.io.File;
import com.nomagic.magicreport.Template;
import com.nomagic.magicreport.engine.ITemplateEngine;
import com.nomagic.magicreport.TemplateEngineFactory;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
ITemplateEngine engine = TemplateEngineFactory.getInstance().createTemplateEngine('docx');
File inputFile = new File("C:\\\\Temp\\\\input_file.docx");
File outputFile = new File("C:\\\\Temp\\\\output_file.docx");
Template myTemplate = engine.createTemplate(inputFile, outputFile);
engine.evaluate(myTemplate);
Any help would be appreciated!
