Executes a template from the repository against the current Document node:

var template = companyhome.childByNamePath('/Data Dictionary/Presentation Templates/doc_info.ftl');
if (template != null)
{
   var result = document.processTemplate(template);
   // output result to the console - could just as easily save the content into a new node...
   logger.log(result);
}

Builds a FreeMarker template directly in the script, also builds up an argument list for the template. The result of the template is saved to a new node as the content:

var template = 'Document name is ${document.name}' + ' The ID argument: ${args["id"]}';
var args = new Array()
args['id'] = '01234-56789';
var result = document.processTemplate(template, args);
// save the template result content to a new node in my home space
var outputFile = userhome.createFile('output.txt');
outputFile.content = result;
文档更新时间: 2020-02-16 16:13   作者:凌云文档