-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
I'm trying to do a String comparison operation and show/hide text in a template. The code is as below:
<% if(P_KEY == "ARF") { %>
Display ARF Text
<% } else { %>
Display non-ARF text
<% } %>
This throws an exception as below:
groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
GStringTemplateScript16.groovy: 2: Invalid variable name. Must start with a letter but was: ?ARF?
. At [2:395] @ line 2, column 395.
cd6c79a8e03"""; if(P_KEY == ?ARF?) {
^
1 error
at groovy.text.GStringTemplateEngine$GStringTemplate.<init>(GStringTemplateEngine.java:190)
at groovy.text.GStringTemplateEngine.createTemplate(GStringTemplateEngine.java:105)
at groovy.text.TemplateEngine.createTemplate(TemplateEngine.java:38)
at org.scriptlet4docx.docx.DocxTemplater.processCleanedTemplate(DocxTemplater.java:158)
at org.scriptlet4docx.docx.DocxTemplater.process(DocxTemplater.java:255)
at org.scriptlet4docx.docx.DocxTemplater.processAndReturnInputStream(DocxTemplater.java:213)
at org.scriptlet4docx.docx.DocxTemplater.process(DocxTemplater.java:230)
I tried to use def key="ARF" and then use the variable to compare, but that also didnt work.
I'm using v0.7.6
Can you please take a look?
Metadata
Metadata
Assignees
Labels
No labels