opensagres/xdocreport

xDocreport/ Freemarker cannot add html styling inside list

bonobothehappyape opened this issue · 0 comments

Hello,

i am using xdocreport to generate a questionnaire in docx with freemarker as template engine.
version 2.0.4

when i iterate the list of questions, sometimes the text of the question contains html (from the backend).
«[#list rootQuestions as q]»«${q.text}»«[/#list]»
when i do
metadata.addFieldAsTextStyling("q.text", SyntaxKind.Html);

i get an error that q is null, (neither q nor q.text is null from the backend)

freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> q  [in template "fr.opensagres.xdocreport.document.docx.DocxReport@7b6cee63!word/document.xml"
 at line 4, column 423]
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign ___NoEscape0 = ___TextStyling... 
	-  [in template "fr.opensagres.xdocreport.document.docx.DocxReport@77750214!word/document.xml"
	-  at line 4, column 368]

but when i remove the field as text styling, i can see the string in the html format.

i have also tried to add the field as a list
metadata.addFieldAsList("q.text");

is there a way to render html styling for a field inside a list ?